]> ruin.nu Git - proglang.git/commitdiff
updated syntax to use define
authorMichael Andreen <harv@ruin.nu>
Thu, 16 Feb 2006 10:17:46 +0000 (10:17 +0000)
committerMichael Andreen <harv@ruin.nu>
Thu, 16 Feb 2006 10:17:46 +0000 (10:17 +0000)
syntax.cf

index bb046b882d380e6977c735c448a617e77843d01c..a0e69538f58bb9a72899ec801b68366d11e3f808 100644 (file)
--- a/syntax.cf
+++ b/syntax.cf
@@ -1,15 +1,17 @@
 
 -- ordinary rules
 
-BTrue. BoolT ::= "true" ;
-BFalse. BoolT ::= "false" ;
+True. Bool ::= "true" ;
+False. Bool ::= "false" ;
 
-SDecl.    Stm      ::= Typ Ident ";" ;
-SDeclAss. Stm      ::= Typ Ident "=" Exp ";" ;
+SDecl.   Stm      ::= Typ Ident "=" Exp ";" ;
+decl.    Stm      ::= Typ Ident ";" ;
+define decl t v = SDecl t  v EDefault ;
 SExp.     Stm      ::= Exp ";" ;
 SBlock.   Stm      ::= "{" [Stm] "}" ;
-SIf.      Stm      ::= "if" "(" Exp ")" Stm ;
-SIfE.     Stm      ::= "if" "(" Exp ")" Stm "else" Stm ;
+if.      Stm      ::= "if" "(" Exp ")" Stm ;
+SIf.     Stm      ::= "if" "(" Exp ")" Stm "else" Stm ;
+define if e s = SIf e s SNoop ;
 SWhile.   Stm      ::= "while" "(" Exp ")" Stm ;
 -- SFor.     Stm      ::= "for" "(" Stm Exp ";" Exp ")" Stm ;
 SPrint.   Stm      ::= "print" Exp ";" ;
@@ -33,7 +35,7 @@ EVar.     Exp3    ::= Ident ;
 EAss.     Exp3    ::= Ident "=" Exp;
 EInt.     Exp3    ::= Integer ;
 ENeg.     Exp3    ::= "-" Exp3 ;
-EBool.    Exp3    ::= BoolT ;
+EBool.    Exp3    ::= Bool ;
 EReadI.   Exp3    ::= "readInt" ;
 EReadB.   Exp3    ::= "readBool" ;
 
@@ -54,6 +56,8 @@ TBool.  Typ  ::= "bool" ;
 -- pragmas
 
 internal ExpT. Exp ::= Typ Exp ;
+internal SNoop. Stm ::= ;
+internal EDefault. Exp ::= ;
 
 comment "/*" "*/" ;
 comment "//" ;