Code to Compile
VAR
THIN : INTEGER;
THIS : INTEGER;
THAT : REAL;
THE : REAL
BEGIN
THAT := THAT + THIS * THAT;
IF THIS > THAT THEN
THIS := THIS
ELSE
THAT := THIS;
THAT := THIS + THIN;
WHILE THIS <= THAT DO
THAT := THIS;
IF THIS < THAT THEN
BEGIN
THAT := (THIS + THAT);
THE := THIS * THAT + THAT
END
END. $
Compiler Output
Parse Trace
In state > 0
Symbol Varsym Number 6
action shift 4
In state > 4
Symbol Ident1 Number 8
action shift 12
In state > 12
Symbol Colon Number 9
action shift 23
In state > 23
Symbol Typesym Number 10
action shift 33
In state > 33
Symbol Semicolon1 Number 11
action shift 41
In state > 41
Symbol Ident1 Number 8
action shift 12
In state > 12
Symbol Colon Number 9
action shift 23
In state > 23
Symbol Typesym Number 10
action shift 33
In state > 33
Symbol Semicolon1 Number 11
action shift 41
In state > 41
Symbol Ident1 Number 8
action shift 12
In state > 12
Symbol Colon Number 9
action shift 23
In state > 23
Symbol Typesym Number 10
action shift 33
In state > 33
Symbol Semicolon1 Number 11
action shift 41
In state > 41
Symbol Ident1 Number 8
action shift 12
In state > 12
Symbol Colon Number 9
action shift 23
In state > 23
Symbol Typesym Number 10
action shift 33
In state > 33
Symbol Beginsym Number 24
action reduce by 4 V1 -> "ident" ":" "type"
In state > 44
Symbol Beginsym Number 24
action reduce by 5 V1 -> "ident" ":" "type" ";" V1
In state > 44
Symbol Beginsym Number 24
action reduce by 5 V1 -> "ident" ":" "type" ";" V1
In state > 44
Symbol Beginsym Number 24
action reduce by 5 V1 -> "ident" ":" "type" ";" V1
In state > 11
Symbol Beginsym Number 24
action reduce by 3 V -> "var" V1
In state > 3
Symbol Beginsym Number 24
action shift 10
In state > 10
Symbol Ident1 Number 8
action shift 7
In state > 7
Symbol Becomes Number 13
action shift 13
In state > 13
Symbol Ident1 Number 8
action shift 19
In state > 19
Symbol Plus Number 26
action reduce by 19 F -> "ident"
In state > 17
Symbol Plus Number 26
action reduce by 17 T -> F
In state > 16
Symbol Plus Number 26
action reduce by 15 E -> T
In state > 24
Symbol Plus Number 26
action shift 27
In state > 27
Symbol Ident1 Number 8
action shift 19
In state > 19
Symbol Times Number 28
action reduce by 19 F -> "ident"
In state > 17
Symbol Times Number 28
action reduce by 17 T -> F
In state > 36
Symbol Times Number 28
action shift 28
In state > 28
Symbol Ident1 Number 8
action shift 19
In state > 19
Symbol Semicolon1 Number 11
action reduce by 19 F -> "ident"
In state > 37
Symbol Semicolon1 Number 11
action reduce by 16 T -> T "*" F
In state > 36
Symbol Semicolon1 Number 11
action reduce by 14 E -> E "+" T
In state > 24
Symbol Semicolon1 Number 11
action reduce by 8 S1 -> "ident" ":=" E
In state > 22
Symbol Semicolon1 Number 11
action shift 32
In state > 32
Symbol Ifsym Number 15
action shift 8
In state > 8
Symbol Ident1 Number 8
action shift 19
In state > 19
Symbol Relop Number 32
action reduce by 19 F -> "ident"
In state > 17
Symbol Relop Number 32
action reduce by 17 T -> F
In state > 16
Symbol Relop Number 32
action reduce by 15 E -> T
In state > 15
Symbol Relop Number 32
action shift 26
In state > 26
Symbol Ident1 Number 8
action shift 19
In state > 19
Symbol Thensym Number 18
action reduce by 19 F -> "ident"
In state > 17
Symbol Thensym Number 18
action reduce by 17 T -> F
In state > 16
Symbol Thensym Number 18
action reduce by 15 E -> T
In state > 35
Symbol Thensym Number 18
action reduce by 20 C -> E "relop" E
In state > 14
Symbol Thensym Number 18
action reduce by 21 CondGoToMark ->
In state > 25
Symbol Thensym Number 18
action shift 34
In state > 34
Symbol Ident1 Number 8
action shift 7
In state > 7
Symbol Becomes Number 13
action shift 13
In state > 13
Symbol Ident1 Number 8
action shift 19
In state > 19
Symbol Elsesym Number 20
action reduce by 19 F -> "ident"
In state > 17
Symbol Elsesym Number 20
action reduce by 17 T -> F
In state > 16
Symbol Elsesym Number 20
action reduce by 15 E -> T
In state > 24
Symbol Elsesym Number 20
action reduce by 8 S1 -> "ident" ":=" E
In state > 42
Symbol Elsesym Number 20
action reduce by 22 GoToMark ->
In state > 45
Symbol Elsesym Number 20
action shift 47
In state > 47
Symbol Ident1 Number 8
action shift 7
In state > 7
Symbol Becomes Number 13
action shift 13
In state > 13
Symbol Ident1 Number 8
action shift 19
In state > 19
Symbol Semicolon1 Number 11
action reduce by 19 F -> "ident"
In state > 17
Symbol Semicolon1 Number 11
action reduce by 17 T -> F
In state > 16
Symbol Semicolon1 Number 11
action reduce by 15 E -> T
In state > 24
Symbol Semicolon1 Number 11
action reduce by 8 S1 -> "ident" ":=" E
In state > 48
Symbol Semicolon1 Number 11
action reduce by 9 S1 -> "if" C CondGoToMark "then" S1 GoToMark "else" S1
In state > 22
Symbol Semicolon1 Number 11
action shift 32
In state > 32
Symbol Ident1 Number 8
action shift 7
In state > 7
Symbol Becomes Number 13
action shift 13
In state > 13
Symbol Ident1 Number 8
action shift 19
In state > 19
Symbol Plus Number 26
action reduce by 19 F -> "ident"
In state > 17
Symbol Plus Number 26
action reduce by 17 T -> F
In state > 16
Symbol Plus Number 26
action reduce by 15 E -> T
In state > 24
Symbol Plus Number 26
action shift 27
In state > 27
Symbol Ident1 Number 8
action shift 19
In state > 19
Symbol Semicolon1 Number 11
action reduce by 19 F -> "ident"
In state > 17
Symbol Semicolon1 Number 11
action reduce by 17 T -> F
In state > 36
Symbol Semicolon1 Number 11
action reduce by 14 E -> E "+" T
In state > 24
Symbol Semicolon1 Number 11
action reduce by 8 S1 -> "ident" ":=" E
In state > 22
Symbol Semicolon1 Number 11
action shift 32
In state > 32
Symbol Whilesym Number 21
action shift 9
In state > 9
Symbol Ident1 Number 8
action reduce by 23 Mark ->
In state > 20
Symbol Ident1 Number 8
action shift 19
In state > 19
Symbol Relop Number 32
action reduce by 19 F -> "ident"
In state > 17
Symbol Relop Number 32
action reduce by 17 T -> F
In state > 16
Symbol Relop Number 32
action reduce by 15 E -> T
In state > 15
Symbol Relop Number 32
action shift 26
In state > 26
Symbol Ident1 Number 8
action shift 19
In state > 19
Symbol Dosym Number 23
action reduce by 19 F -> "ident"
In state > 17
Symbol Dosym Number 23
action reduce by 17 T -> F
In state > 16
Symbol Dosym Number 23
action reduce by 15 E -> T
In state > 35
Symbol Dosym Number 23
action reduce by 20 C -> E "relop" E
In state > 30
Symbol Dosym Number 23
action reduce by 21 CondGoToMark ->
In state > 39
Symbol Dosym Number 23
action shift 43
In state > 43
Symbol Ident1 Number 8
action shift 7
In state > 7
Symbol Becomes Number 13
action shift 13
In state > 13
Symbol Ident1 Number 8
action shift 19
In state > 19
Symbol Semicolon1 Number 11
action reduce by 19 F -> "ident"
In state > 17
Symbol Semicolon1 Number 11
action reduce by 17 T -> F
In state > 16
Symbol Semicolon1 Number 11
action reduce by 15 E -> T
In state > 24
Symbol Semicolon1 Number 11
action reduce by 8 S1 -> "ident" ":=" E
In state > 46
Symbol Semicolon1 Number 11
action reduce by 11 S1 -> "while" Mark C CondGoToMark "do" S1
In state > 22
Symbol Semicolon1 Number 11
action shift 32
In state > 32
Symbol Ifsym Number 15
action shift 8
In state > 8
Symbol Ident1 Number 8
action shift 19
In state > 19
Symbol Relop Number 32
action reduce by 19 F -> "ident"
In state > 17
Symbol Relop Number 32
action reduce by 17 T -> F
In state > 16
Symbol Relop Number 32
action reduce by 15 E -> T
In state > 15
Symbol Relop Number 32
action shift 26
In state > 26
Symbol Ident1 Number 8
action shift 19
In state > 19
Symbol Thensym Number 18
action reduce by 19 F -> "ident"
In state > 17
Symbol Thensym Number 18
action reduce by 17 T -> F
In state > 16
Symbol Thensym Number 18
action reduce by 15 E -> T
In state > 35
Symbol Thensym Number 18
action reduce by 20 C -> E "relop" E
In state > 14
Symbol Thensym Number 18
action reduce by 21 CondGoToMark ->
In state > 25
Symbol Thensym Number 18
action shift 34
In state > 34
Symbol Beginsym Number 24
action shift 10
In state > 10
Symbol Ident1 Number 8
action shift 7
In state > 7
Symbol Becomes Number 13
action shift 13
In state > 13
Symbol Lparen1 Number 30
action shift 18
In state > 18
Symbol Ident1 Number 8
action shift 19
In state > 19
Symbol Plus Number 26
action reduce by 19 F -> "ident"
In state > 17
Symbol Plus Number 26
action reduce by 17 T -> F
In state > 16
Symbol Plus Number 26
action reduce by 15 E -> T
In state > 29
Symbol Plus Number 26
action shift 27
In state > 27
Symbol Ident1 Number 8
action shift 19
In state > 19
Symbol Rparen1 Number 31
action reduce by 19 F -> "ident"
In state > 17
Symbol Rparen1 Number 31
action reduce by 17 T -> F
In state > 36
Symbol Rparen1 Number 31
action reduce by 14 E -> E "+" T
In state > 29
Symbol Rparen1 Number 31
action shift 38
In state > 38
Symbol Semicolon1 Number 11
action reduce by 18 F -> "(" E ")"
In state > 17
Symbol Semicolon1 Number 11
action reduce by 17 T -> F
In state > 16
Symbol Semicolon1 Number 11
action reduce by 15 E -> T
In state > 24
Symbol Semicolon1 Number 11
action reduce by 8 S1 -> "ident" ":=" E
In state > 22
Symbol Semicolon1 Number 11
action shift 32
In state > 32
Symbol Ident1 Number 8
action shift 7
In state > 7
Symbol Becomes Number 13
action shift 13
In state > 13
Symbol Ident1 Number 8
action shift 19
In state > 19
Symbol Times Number 28
action reduce by 19 F -> "ident"
In state > 17
Symbol Times Number 28
action reduce by 17 T -> F
In state > 16
Symbol Times Number 28
action shift 28
In state > 28
Symbol Ident1 Number 8
action shift 19
In state > 19
Symbol Plus Number 26
action reduce by 19 F -> "ident"
In state > 37
Symbol Plus Number 26
action reduce by 16 T -> T "*" F
In state > 16
Symbol Plus Number 26
action reduce by 15 E -> T
In state > 24
Symbol Plus Number 26
action shift 27
In state > 27
Symbol Ident1 Number 8
action shift 19
In state > 19
Symbol Endsym Number 25
action reduce by 19 F -> "ident"
In state > 17
Symbol Endsym Number 25
action reduce by 17 T -> F
In state > 36
Symbol Endsym Number 25
action reduce by 14 E -> E "+" T
In state > 24
Symbol Endsym Number 25
action reduce by 8 S1 -> "ident" ":=" E
In state > 22
Symbol Endsym Number 25
action reduce by 6 S -> S1
In state > 40
Symbol Endsym Number 25
action reduce by 7 S -> S1 ";" S
In state > 21
Symbol Endsym Number 25
action shift 31
In state > 31
Symbol Endsym Number 25
action reduce by 12 S1 -> "begin" S "end"
In state > 42
Symbol Endsym Number 25
action reduce by 10 S1 -> "if" C CondGoToMark "then" S1
In state > 22
Symbol Endsym Number 25
action reduce by 6 S -> S1
In state > 40
Symbol Endsym Number 25
action reduce by 7 S -> S1 ";" S
In state > 40
Symbol Endsym Number 25
action reduce by 7 S -> S1 ";" S
In state > 40
Symbol Endsym Number 25
action reduce by 7 S -> S1 ";" S
In state > 40
Symbol Endsym Number 25
action reduce by 7 S -> S1 ";" S
In state > 21
Symbol Endsym Number 25
action shift 31
In state > 31
Symbol Period1 Number 3
action reduce by 12 S1 -> "begin" S "end"
In state > 6
Symbol Period1 Number 3
action reduce by 2 B -> V S1
In state > 2
Symbol Period1 Number 3
action shift 5
In state > 5
Symbol Dollar Number 33
action reduce by 1 P -> B "."
In state > 1
Symbol Dollar Number 33
action accept 1
Three Address Code
0 @Temp0 := intoReal(this)
1 @Temp1 := @Temp0*that
2 @Temp2 := that+@Temp1
3 that := @Temp2
4 @Temp3 := intoReal(this)
5 @Temp4 := @Temp3>that
6 if not @Temp4 then goto 9
7 this := this
8 GoTo 11
9 @Temp5 := intoReal(this)
10 that := @Temp5
11 @Temp6 := this+thin
12 @Temp7 := intoReal(@Temp6)
13 that := @Temp7
14 @Temp8 := intoReal(this)
15 @Temp9 := @Temp8<=that
16 if not @Temp9 then goto 20
17 @Temp10 := intoReal(this)
18 that := @Temp10
19 GoTo 14
20 @Temp11 := intoReal(this)
21 @Temp12 := @Temp11<hat
22 if not @Temp12 then goto 30
23 @Temp13 := intoReal(this)
24 @Temp14 := @Temp13+that
25 that := @Temp14
26 @Temp15 := intoReal(this)
27 @Temp16 := @Temp15*that
28 @Temp17 := @Temp16+that
29 the := @Temp17
30 Exit