]> ruin.nu Git - proglang.git/commitdiff
changed the documentation
authorMichael Andreen <harv@ruin.nu>
Sun, 26 Feb 2006 21:11:54 +0000 (21:11 +0000)
committerMichael Andreen <harv@ruin.nu>
Sun, 26 Feb 2006 21:11:54 +0000 (21:11 +0000)
documentation
syntax.cf

index c77568b12f0b8d6434f10e1ef99c82d6a6d751f9..28be8953c583ac46e7fc73b3998982312167a67d 100644 (file)
@@ -1,7 +1,8 @@
 ####### DOCUMENTATIATOIAITAT ION ########
 
 
-a simple c-like language with support for if/else-statements, while-loops and the standard arithmetic (+, -, /, *) and comparison expressions (<, >, <=, >=, ==, !=). also, post increase/decrease expressions (++, --) are supported.
+a simple c-like language with support for if/else-statements, while-loops and the standard arithmetic (+, -, /, *) and comparison expressions (<, >, <=, >=, ==, !=). also, post increase/decrease expressions (++, --) are supported. Assignments are allowed in expressions, but they are only allowed on the right side of arithmetic/comparision operators if they are put inside parenthesis
+
 
 data types:
 integers and booleans.
@@ -13,21 +14,5 @@ comments:
 
 shift/reduce conflicts:
 
-18 conflicts in total.
-
-1) Exp1 followed by (<,<=,>,>=,==,!=,+,-) 8 conflicts:
-In these cases the Exp1 could've been reduced to Exp, but happy does the correct thing and shifts the operator token onto the stack, since Exp followed by these operators doesn't match any rules.
-
-2) Exp2 followed by (*,/) 4 conflicts:
-In two cases the Exp2 expression could be reduced to Exp1, but this wouldn't match the rules for these operators, so shifting is the correct action.
-
-In two other cases the Exp2 in front of these operators can be reduced to addition and subtraction expressions, which would destroy operator priority, so shifting is correct here.
-
-3) Exp1 followed by (+,-) 2 conflicts:
-In both these cases Exp1 could be reduced together with another Exp1 and a comparative operator to an Exp, but just as in the above case this would be very bad for operator priority, so shifting is right here.
-
-4) if with else: 1 conflict
+if with else: 1 conflict
 An if statement before the else could be reduced to an if statement lacking the else, but the correct thing is to shift it onto the stack.
-
-5) if/ifelse/while followed by (;): 3 conflicts
-Here we have redundant semicolons, these could all be reduced to individual statements without the ';'. Such a reduction wouldn't cause any harm, but neither does the shifting, it's an ok choice.
index dc7e65960cacd24d1430ed90c02bf9ba07c69c8a..8bb36219c11d1b7daeeeeaf9065a534d37f8345b 100644 (file)
--- a/syntax.cf
+++ b/syntax.cf
@@ -22,7 +22,7 @@ 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 ;
-postIncr.    Exp3    ::= Ident "++" ;
+postIncr. Exp3    ::= Ident "++" ;
 define postIncr i = EPost i Plus ;
 postDecr.    Exp3    ::= Ident "--" ;
 define postDecr i = EPost i Minus ;