first
This commit is contained in:
parent
586a58fd94
commit
c707e3253c
53 changed files with 500 additions and 27 deletions
4
ass3/zbirnik/bin/dune
Normal file
4
ass3/zbirnik/bin/dune
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
(executable
|
||||
(public_name zbirnik)
|
||||
(name main)
|
||||
(libraries zbirnik))
|
||||
28
ass3/zbirnik/bin/main.ml
Normal file
28
ass3/zbirnik/bin/main.ml
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
open Zbirnik.Parser
|
||||
open Zbirnik.SemanticAnalyzer
|
||||
|
||||
|
||||
(* Helper functions to print optional values *)
|
||||
let print_opt_string = function
|
||||
| Some s -> s
|
||||
| None -> ""
|
||||
|
||||
let print_opt_int = function
|
||||
| Some n -> Printf.sprintf "%04X" n
|
||||
| None -> "----"
|
||||
|
||||
|
||||
(* Main function to print a list of lineSemantic *)
|
||||
let print_lineSemantic_list (lines : lineSemantic list) =
|
||||
List.iter (fun l ->
|
||||
Printf.printf "%4d | %8s | %6s | %20s | %s | %s\n"
|
||||
l.line_no
|
||||
(print_opt_string l.label)
|
||||
(string_of_mnemonic l.opcode)
|
||||
(string_of_mnemonic_type l.mnem)
|
||||
(print_opt_string l.comment)
|
||||
(print_opt_int l.loc)
|
||||
) lines
|
||||
|
||||
|
||||
let () = print_lineSemantic_list (checkLineSemanticOfCode (parser "../../ass1/horner.asm") )
|
||||
Loading…
Add table
Add a link
Reference in a new issue