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