X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=documentation;h=28be8953c583ac46e7fc73b3998982312167a67d;hb=9597d94cbb1b328c27883c8421b1fef3211fb698;hp=cb693df417c88f4430589c5ac0de2ce533360c91;hpb=67721d82f79e56db9c728aed76a3ad9dcca005c2;p=proglang.git diff --git a/documentation b/documentation index cb693df..28be895 100644 --- a/documentation +++ b/documentation @@ -1,77 +1,18 @@ ####### 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. Assignments are allowed in expressions, but they are only allowed on the right side of arithmetic/comparision operators if they are put inside parenthesis -a simple c-like language with support for if/else-statements, while-loops and the standard arithmetic (+, -, /, *) and comparison expressions (<, >, <=, >=, ==, !=). also, increase/decrease expressions (++, --) are supported. - data types: integers and booleans. comments: // and /* */ comments are allowed. +(For compilation to work the Bool type in Abssyntax has to be removed so the internal haskell type is used) +shift/reduce conflicts: - - - - - - - - - - -examples: - -fib ---- -int n1 = 0; -int n2 = 1; -int n = readInt; - -while(n-- > 0){ - int temp = n1+n2; - n1 = n2; - n2 = temp; -} -print n2; - - -tests while, decr and assignment. - - - -if --- -if (readBool) { - if (readInt < 0) - print true; - else - print false; -} - - -tests if and if/else. - - - -sum ---- -int n; -int sum = 0; -while ((n = readInt) != -1) sum = sum + n; -print sum; - - - - -var ---- -int a = 3; -int b = a - 5; -int c = a + b*7; -bool d = a == b; - -tests simple variable operations. \ No newline at end of file +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.