8
CS269: HW/SW Engineering of Embedded Systems, Winter02
Abstract syntax trees
•
An
abstract syntax tree
(AST) represents how a program has
been derived from the grammar.
–
The
nodes
of the AST represent productions of the grammar
–
The
leaves
of the AST represent the terminal symbols
CompileUnit:
PackageDeclaration
opt
ImportDeclarations
opt
TypeDeclarations
opt
PackageDeclaration:
package
Name
;
Name:
IDENTIFIER
|
Name
. IDENTIFIER
java
lang
package
;
.
Name
Name
CompileUnit
PackageDeclaration
...