summaryrefslogtreecommitdiffstats
path: root/doc/demo-funktionen.txt
blob: ad16f4bcee0fc7cd83b721a47ba885114f798ba9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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