Forráskód Böngészése

Added empty assmebly phase

Taddeus Kroes 12 éve
szülő
commit
3d3c4d5421
6 módosított fájl, 19 hozzáadás és 5 törlés
  1. 1 1
      Makefile
  2. 1 1
      ast.ml
  3. BIN
      doc/assembler.pdf
  4. 3 3
      main.ml
  5. 11 0
      phases/assemble.ml
  6. 3 0
      phases/print.ml

+ 1 - 1
Makefile

@@ -1,6 +1,6 @@
 RESULT := civicc
 PHASES := load parse print desug constant_propagation context_analysis \
-	expand_dims typecheck dim_reduce bool_op extern_vars
+	expand_dims typecheck dim_reduce bool_op extern_vars assemble
 SOURCES := ast.ml stringify.mli stringify.ml util.mli util.ml lexer.mll \
 	parser.mly $(patsubst %,phases/%.ml,$(PHASES)) main.ml
 PRE_TARGETS := ast.cmi ast.o stringify.cmi stringify.o util.cmi util.o

+ 1 - 1
ast.ml

@@ -82,7 +82,7 @@ type intermediate =
     | Empty
     | FileContent of string * string
     | Ast of node
-    | Assembly of string list
+    | Assembly of string list list
 
 (* exceptions *)
 exception LocError of loc * string

BIN
doc/assembler.pdf


+ 3 - 3
main.ml

@@ -16,9 +16,9 @@ let compile () =
         Parse.phase;
         (*Print.phase;*)
         Desug.phase;
-        Print.phase;
+        (*Print.phase;*)
         Constant_propagation.phase;
-        Print.phase;
+        (*Print.phase;*)
         Context_analysis.phase;
         (*Print.phase;*)
         Typecheck.phase;
@@ -30,7 +30,7 @@ let compile () =
         Dim_reduce.phase;
         (*Print.phase;*)
         Extern_vars.phase;
-        (*Print.phase;*)
+        Print.phase;
         (*
         Assemble.phase;
         Print.phase;

+ 11 - 0
phases/assemble.ml

@@ -0,0 +1,11 @@
+open Ast
+open Util
+
+let assemble = function
+    | node -> [[""]]
+
+let rec phase input =
+    prerr_endline "- Assembly";
+    match input with
+    | Ast node -> Assembly (assemble node)
+    | _ -> raise (InvalidInput "assembly")

+ 3 - 0
phases/print.ml

@@ -19,4 +19,7 @@ let phase = function
         );
         input
 
+    | Assembly instrs as input ->
+        input
+
     | _ -> raise (InvalidInput "print")