]> ruin.nu Git - proglang.git/blobdiff - syntax.cf
removed most shift/reduce conflicts by moving EAss from Exp3 to Exp and thus disallow...
[proglang.git] / syntax.cf
index 28e93f9a4f1afb152c4ecb6997953411bc7d9b56..dc7e65960cacd24d1430ed90c02bf9ba07c69c8a 100644 (file)
--- a/syntax.cf
+++ b/syntax.cf
@@ -16,18 +16,17 @@ SWhile.   Stm      ::= "while" "(" Exp ")" Stm ;
 -- SFor.     Stm      ::= "for" "(" Stm Exp ";" Exp ")" Stm ;
 SPrint.   Stm      ::= "print" Exp ";" ;
 
--- VVar.     Var      ::= Ident ;
--- VAss.     Var      ::= Ident "=" Exp;
-
+EAss.     Exp     ::= Ident "=" Exp;
 BExp.     Exp     ::= Exp1 BOp Exp1 ;
 op1.      Exp1    ::= Exp1 Op1 Exp2 ;
 define op1 e1 o e2 = OpExp e1 o e2 ;
 op2.      Exp2    ::= Exp2 Op2 Exp3 ;
 define op2 e1 o e2 = OpExp e1 o e2 ;
-EIncr.    Exp3    ::= Ident "++" ;
-EDecr.    Exp3    ::= Ident "--" ;
+postIncr.    Exp3    ::= Ident "++" ;
+define postIncr i = EPost i Plus ;
+postDecr.    Exp3    ::= Ident "--" ;
+define postDecr i = EPost i Minus ;
 EVar.     Exp3    ::= Ident ;
-EAss.     Exp3    ::= Ident "=" Exp;
 EInt.     Exp3    ::= Integer ;
 ENeg.     Exp3    ::= "-" Exp3 ;
 EBool.    Exp3    ::= Bool ;
@@ -37,7 +36,7 @@ EReadB.   Exp3    ::= "readBool" ;
 coercions Exp 3 ;
 
 
-_.        Stm     ::= Stm ";" ;
+-- _.        Stm     ::= Stm ";" ;
 
 
 terminator Stm "" ;
@@ -71,6 +70,7 @@ internal SNoop. Stm ::= ;
 internal EDefault. Exp ::= ;
 internal OpExp. Exp ::= Exp Op Exp ;
 internal NoType. Type ::= ;
+internal EPost. Exp ::= Ident Op1 ;
 
 comment "/*" "*/" ;
 comment "//" ;