working on prehod 2...

This commit is contained in:
Jaka Furlan 2025-12-13 17:27:34 +01:00
parent f79aa96359
commit 6261d9fe37
6 changed files with 84 additions and 27 deletions

View file

@ -0,0 +1,32 @@
(*naloga instruction modula je ustvarjanje instructionLista, torej vsebine T zapisa*)
(*sem spada izbira nacina naslavljanja, dolocanje ali je operand simbol itd..*)
open SemanticAnalyzer
let string_is_symbol (s : string) : bool * string =
try
let _ = int_of_string s in
true, ""
with Failure _ -> false, s
(*preveri ali je operand iz mnemonic_type simbol ali stevilo*)
let operand_is_symbol (operand : mnemonic_type) : bool * string = (*vrne isSymbol in symbol*)
match operand with
| MnemonicD -> false, ""
| MnemonicDn s -> string_is_symbol s
| MnemonicF1 -> false, ""
| MnemonicF2n _ -> false, ""
| MnemonicF2r _ -> false, ""
| MnemonicF2rn (_, _) -> false, ""
| MnemonicF2rr (_, _) -> false, ""
| MnemonicF3 -> false, ""
| MnemonicF3m s -> string_is_symbol s
| MnemonicF4m s -> string_is_symbol s
| MnemonicSd s -> string_is_symbol s
| MnemonicSn _ -> false, ""
| COMMENT -> false, ""
let create_opcode_symbol (opcode : mnemonic) (locSimbola : int) : string =
(*izberi nacin naslavljanja in naredi string ukaza*)