Commits

Anonymous committed 5b7f29b

.

Comments (0)

Files changed (2)

               );
               print_params r
 
+let rec print_expr e = match e with
+  | EInt i -> Printf.printf "%d\n" i
+  | ENull -> Printf.printf "null"
+  | EString s -> Printf.printf "%s\n" s
+  | EPair (e1, e2) -> print_expr e1; print_expr e2
+  | EAssign (lhs, oper, rhs) -> print_expr lhs; Printf.printf "="; print_expr rhs
+  | EBinary (lhs, oper, rhs) -> print_expr lhs; Printf.printf "OP"; print_expr rhs
+  | ENone -> Printf.printf "none\n"
+  | EId s -> Printf.printf "%s\n" s
+
+let rec print_exprs e = match e with
+  | [] -> ()
+  | (c::r) -> print_expr c; print_exprs r
+
 let rec print_statement s = match s with
   | SIf -> Printf.printf("If\n")
   | SWhile -> Printf.printf("While\n")
   | SWith -> Printf.printf("With\n")
   | SReturn -> Printf.printf("Return\n")
   | SEndSemi -> () (*Printf.printf("EndSemi\n") *)
-  | SExprs exprs -> Printf.printf("Exprs\n")
+  | SExprs exprs -> Printf.printf("Exprs ==\n");
+                    print_exprs exprs
   | SList stmts -> print_statements stmts
 and print_statements statements = match statements with 
   [] -> ()
 ;
 
 variable:
-	ID { ENone }
+	ID { EId($1) }
 	| ID EQ assignmentexpression { ENone }
 ;