working on prehod 2...
This commit is contained in:
parent
f79aa96359
commit
6261d9fe37
6 changed files with 84 additions and 27 deletions
32
ass3/zbirnik/lib/instruction.ml
Normal file
32
ass3/zbirnik/lib/instruction.ml
Normal 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*)
|
||||
Loading…
Add table
Add a link
Reference in a new issue