X-Git-Url: https://ruin.nu/git/?p=proglang.git;a=blobdiff_plain;f=syntax.cf;h=0347ce56e2982362825fb40f7ec2582f778e9690;hp=26408246305de004f448085d22bb717adca8736b;hb=fd3bc0ef4542783846af4e2c4f986e94f96c74ff;hpb=fe6d5e0ac088e6b648a5029b101402c017fd04de diff --git a/syntax.cf b/syntax.cf index 2640824..0347ce5 100644 --- 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 "//" ;