]> ruin.nu Git - proglang.git/blobdiff - syntax.cf
added constructor for declaration with default value
[proglang.git] / syntax.cf
index 26408246305de004f448085d22bb717adca8736b..0347ce56e2982362825fb40f7ec2582f778e9690 100644 (file)
--- a/syntax.cf
+++ b/syntax.cf
@@ -13,14 +13,8 @@ Program.  Stms ::= [Stm] ;
 
 SExp.      Stm      ::= Exp ";" ;
 SBlock.    Stm      ::= "{" [Stm] "}" ;
-declIntE.  Stm      ::= "int" Ident "=" Exp ";" ;
-declBoolE. Stm      ::= "bool" Ident "=" Exp ";" ;
-define declIntE x e = SDecl TInt x e;
-define declBoolE x e = SDecl TBool x e;
-declInt. Stm ::= "int" Ident ";" ;
-declBool. Stm ::= "bool" Ident ";" ;
-define declInt x  = SDecl TInt x (EInt 0);
-define declBool x = SDecl TBool x (EBool False);
+SDecl. Stm ::= Type Ident "=" Exp ";" ;
+SDeclD. Stm ::= Type Ident ";" ;
 
 
 SWhile.   Stm      ::= "while" "(" Exp ")" Stm ;
@@ -96,7 +90,6 @@ internal BiOpExp. Exp ::= Exp Op Exp ;
 internal EPost. Exp ::= Ident Op1 ;
 
 internal SNoop. Stm ::= ;
-internal SDecl. Stm ::= Type Ident "=" Exp ";" ;
 
 comment "/*" "*/" ;
 comment "//" ;