-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathold_main.sml
More file actions
29 lines (23 loc) · 819 Bytes
/
old_main.sml
File metadata and controls
29 lines (23 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
structure Main =
struct
structure F = MIPSFrame
structure R = Translate (F)
structure S = Semant (R)
fun main (fileName : string) =
let val _ = ()
(* Lex and Parse --> AST *)
val absyn = Parse.parse fileName
(* Typecheck and translate --> fragment list *)
val _ = R.fragList := []
val frags = S.transProg absyn
(* For testing: print the fragment list *)
fun printFragment (F.PROC ({body = body', frame = frame'})) =
(F.printFrame frame';
Printtree.printtree (TextIO.stdOut, body');
print "\n")
| printFragment (F.STRING (label', literal)) =
print ("[STRING] " ^ (Symbol.name label') ^ " \"" ^ literal ^ "\"\n")
in app printFragment frags;
frags
end
end