Begin translation module
[tiger.ml.git] / README.md
index 0678fa9..6127cf9 100644 (file)
--- a/README.md
+++ b/README.md
@@ -16,10 +16,10 @@ Status
 - [x] ch 3: Parser
 - [x] ch 4: AST
 - [x] ch 5: Semantic Analysis (type checking)
+- [x] ch 6: Activation Records
 #### In-progress
-- [ ] ch 6: Activation Records
-#### TODO (short-term)
 - [ ] ch 7: Translation to Intermediate Code
+#### TODO (short-term)
 - [ ] ch 08: Basic Blocks and Traces
 - [ ] ch 09: Instruction Selection
 - [ ] ch 10: Liveness Analysis
@@ -104,6 +104,33 @@ interspersion patterns in the rules like:
 for the exception of `var_dec`, which, since we do not need to group its
 consecutive sequences, can be reduced upon first sighting.
 
+The final rules I ended-up with are:
+
+    decs:
+      | var_dec   decs_any          { $1 :: $2 }
+      | fun_decs  decs_any_but_fun  { (Ast.FunDecs  $1) :: $2 }
+      | typ_decs  decs_any_but_typ  { (Ast.TypeDecs $1) :: $2 }
+      ;
+
+    decs_any:
+      |                             { [] }
+      | var_dec   decs_any          { $1 :: $2 }
+      | fun_decs  decs_any_but_fun  { (Ast.FunDecs  $1) :: $2 }
+      | typ_decs  decs_any_but_typ  { (Ast.TypeDecs $1) :: $2 }
+      ;
+
+    decs_any_but_fun:
+      |                             { [] }
+      | var_dec   decs_any          { $1 :: $2 }
+      | typ_decs  decs_any_but_typ  { (Ast.TypeDecs $1) :: $2 }
+      ;
+
+    decs_any_but_typ:
+      |                             { [] }
+      | var_dec   decs_any          { $1 :: $2 }
+      | fun_decs  decs_any_but_fun  { (Ast.FunDecs $1) :: $2 }
+      ;
+
 ##### lval
 
 ### AST
This page took 0.021272 seconds and 4 git commands to generate.