diff options
author | Andreas Nüßlein <nutz@unfoog.de> | 2009-05-05 21:47:07 +0200 |
---|---|---|
committer | Andreas Nüßlein <nutz@unfoog.de> | 2009-05-05 21:47:07 +0200 |
commit | 0ce90dd96fa34e3bc1c9b78683198c23b3d22ed6 (patch) | |
tree | fc4b514b243d342c2f075e7a9a0a4058bf41e69a /demo-funktionen.txt | |
download | swppy-0ce90dd96fa34e3bc1c9b78683198c23b3d22ed6.tar.gz swppy-0ce90dd96fa34e3bc1c9b78683198c23b3d22ed6.tar.xz swppy-0ce90dd96fa34e3bc1c9b78683198c23b3d22ed6.zip |
initial
Diffstat (limited to 'demo-funktionen.txt')
-rw-r--r-- | demo-funktionen.txt | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/demo-funktionen.txt b/demo-funktionen.txt new file mode 100644 index 0000000..ad16f4b --- /dev/null +++ b/demo-funktionen.txt @@ -0,0 +1,53 @@ + +fun fib[a] + if a < 2 + @1 + @( fib[a-1] + fib[a-2] ) +end + +# main function +fun main[] + sum = 0 + i = 0 + while (i < 10) + sum = sum + fib[i = i + 1] + end + @sum +end + +#------------------------------------------------- alex + +0 : "fib" +1 : "a" + +<fun> <identifier,0> <[> <identifier,1> <]> <nl> +<tab> <if> <identifier,1> <operator,lessthan> <number,2> <nl> +<tab> <tab> <return> <number,1> <nl> +<tab> <return> <(><identifier,0> <[> <identifier,1> <operator,minus> <number,1> <]> <operator,plus> <identifier,0> <[> <identifier,1> <operator,minus> <number,2> <]> <)> <nl> +<end> + +... + + +#------------------------------------------------- michael + +PROGRAM +| ++- FUNCTION +| + <fun> <identifier,0> <[> <identifier,1> <]> STATEMENT <end> +| + <if> EXPRESSION STATEMENT <end> +| + EXPRESSION OPERATOR EXPRESSION + .... +| + <identifier,1> + <operator,lessthan> +<number,2> ++- FUNCTION +... + +#------------------------------------------------- nutz + + +zwischencode zeug mit annotiertem baum +3-Adress-Code + +#-------------------------------------------------- jana + + +maschinencode / endprodukt |