Java Reference
In-Depth Information
1 Start
Stmt ast
$
return ( ast )
13
2 Stmt result
id var
assign E expr
result ← make
F
amily
( assign
, var , expr )
14
3
|
if
lparen E p
rparen Stmt s
fi
result ← make
F
amily
( if
, p , s ,make
N
ode
())
15
4
|
if
lparen E p
rparen Stmt s 1 else Stmt s 2 fi
result ← make
F
amily
( if
, p , s 1
, s 2)
16
5
|
while lparen E p
rparen do Stmt s
od
result ← make
F
amily
(while
, p , s )
17
6
|
begin Stmts list
end
result ← make
F
amily
( block
, list )
18
7 Stmts result
Stmts so f ar
semi Stmt next
result so f ar . makeSiblings( next )
19
8
|
Stmt f irst
result f irst
20
9 E result
E e 1 plus T e 2
result ← make
F
amily
( plus
, e 1
, e 2)
21
10
|
T e
result e
22
11 T result
id var
result ← make
N
ode
( var )
23
12
|
num val
result ← make
N
ode
( val )
24
Figure 7.17: Semantic actions for grammar in Figure 7.14.
Search WWH ::




Custom Search