]> ruin.nu Git - proglang.git/blob - documentation
more or less done with the syntx
[proglang.git] / documentation
1 ####### DOCUMENTATIATOIAITAT ION ########
2
3
4 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.
5
6 data types:
7 integers and booleans.
8
9 comments:
10 // and /* */ comments are allowed.
11
12 (For compilation to work the Bool type in Abssyntax has to be removed so the internal haskell type is used)
13
14 shift/reduce conflicts:
15
16 18 conflicts in total.
17
18 1) Exp1 followed by (<,<=,>,>=,==,!=,+,-) 8 conflicts:
19 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.
20
21 2) Exp2 followed by (*,/) 4 conflicts:
22 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.
23
24 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.
25
26 3) Exp1 followed by (+,-) 2 conflicts:
27 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.
28
29 4) if with else: 1 conflict
30 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.
31
32 5) if/ifelse/while followed by (;): 3 conflicts
33 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.