X-Git-Url: https://ruin.nu/git/?p=proglang.git;a=blobdiff_plain;f=syntax.cf;h=0347ce56e2982362825fb40f7ec2582f778e9690;hp=7b84054391014ef81d22f0f03d8e8866af3049ce;hb=d553df8dfdffca78342d6fae142ceded9cd64415;hpb=2c2f90fca1005f6dedc69ee7f3d7c5072e5c123b diff --git a/syntax.cf b/syntax.cf index 7b84054..0347ce5 100644 --- a/syntax.cf +++ b/syntax.cf @@ -1,14 +1,21 @@ -- ordinary rules + +True. Bool ::= "true" ; +False. Bool ::= "false" ; + +TInt. Type ::= "int" ; +TBool. Type ::= "bool" ; + Program. Stms ::= [Stm] ; -SExp. Stm ::= Exp ";" ; -SBlock. Stm ::= "{" [Stm] "}" ; -SDecl. Stm ::= Type Ident "=" Exp ";" ; -decl. Stm ::= Type Ident ";" ; -define decl t v = SDecl t v EDefault ; +SExp. Stm ::= Exp ";" ; +SBlock. Stm ::= "{" [Stm] "}" ; +SDecl. Stm ::= Type Ident "=" Exp ";" ; +SDeclD. Stm ::= Type Ident ";" ; + SWhile. Stm ::= "while" "(" Exp ")" Stm ; SIf. Stm ::= "if" "(" Exp ")" Stm "else" Stm ; @@ -74,21 +81,16 @@ _. Op ::= Op2; _. Op ::= Op0; -True. Bool ::= "true" ; -False. Bool ::= "false" ; - -TInt. Type ::= "int" ; -TBool. Type ::= "bool" ; - -- pragmas -internal ExpT. Exp ::= Type Exp ; -internal SNoop. Stm ::= ; -internal EDefault. Exp ::= ; +-- internal ExpT. Exp ::= Type Exp ; +-- internal EDefault. Exp ::= ; internal BiOpExp. Exp ::= Exp Op Exp ; -internal NoType. Type ::= ; +-- internal NoType. Type ::= ; internal EPost. Exp ::= Ident Op1 ; +internal SNoop. Stm ::= ; + comment "/*" "*/" ; comment "//" ;