<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
an	O
abstract	B-Data_Structure
syntax	I-Data_Structure
tree	I-Data_Structure
(	O
AST	O
)	O
,	O
or	O
just	O
syntax	O
tree	B-Application
,	O
is	O
a	O
tree	B-Application
representation	O
of	O
the	O
abstract	B-Application
syntactic	I-Application
structure	O
of	O
text	O
(	O
often	O
source	O
code	O
)	O
written	O
in	O
a	O
formal	O
language	O
.	O
</s>
<s>
Each	O
node	O
of	O
the	O
tree	B-Application
denotes	O
a	O
construct	O
occurring	O
in	O
the	O
text	O
.	O
</s>
<s>
For	O
instance	O
,	O
grouping	O
parentheses	O
are	O
implicit	O
in	O
the	O
tree	B-Application
structure	O
,	O
so	O
these	O
do	O
not	O
have	O
to	O
be	O
represented	O
as	O
separate	O
nodes	O
.	O
</s>
<s>
This	O
distinguishes	O
abstract	B-Data_Structure
syntax	I-Data_Structure
trees	I-Data_Structure
from	O
concrete	O
syntax	O
trees	O
,	O
traditionally	O
designated	O
parse	B-Language
trees	O
.	O
</s>
<s>
Parse	B-Language
trees	O
are	O
typically	O
built	O
by	O
a	O
parser	B-Language
during	O
the	O
source	O
code	O
translation	O
and	O
compiling	B-Language
process	O
.	O
</s>
<s>
Abstract	B-Data_Structure
syntax	I-Data_Structure
trees	I-Data_Structure
are	O
also	O
used	O
in	O
program	O
analysis	O
and	O
program	B-Application
transformation	I-Application
systems	I-Application
.	O
</s>
<s>
Abstract	B-Data_Structure
syntax	I-Data_Structure
trees	I-Data_Structure
are	O
data	B-General_Concept
structures	I-General_Concept
widely	O
used	O
in	O
compilers	B-Language
to	O
represent	O
the	O
structure	O
of	O
program	O
code	O
.	O
</s>
<s>
An	O
AST	O
is	O
usually	O
the	O
result	O
of	O
the	O
syntax	B-Language
analysis	I-Language
phase	O
of	O
a	O
compiler	B-Language
.	O
</s>
<s>
It	O
often	O
serves	O
as	O
an	O
intermediate	O
representation	O
of	O
the	O
program	O
through	O
several	O
stages	O
that	O
the	O
compiler	B-Language
requires	O
,	O
and	O
has	O
a	O
strong	O
impact	O
on	O
the	O
final	O
output	O
of	O
the	O
compiler	B-Language
.	O
</s>
<s>
An	O
AST	O
has	O
several	O
properties	O
that	O
aid	O
the	O
further	O
steps	O
of	O
the	O
compilation	B-Language
process	O
:	O
</s>
<s>
An	O
AST	O
usually	O
contains	O
extra	O
information	O
about	O
the	O
program	O
,	O
due	O
to	O
the	O
consecutive	O
stages	O
of	O
analysis	O
by	O
the	O
compiler	B-Language
.	O
</s>
<s>
For	O
example	O
,	O
it	O
may	O
store	O
the	O
position	O
of	O
each	O
element	O
in	O
the	O
source	O
code	O
,	O
allowing	O
the	O
compiler	B-Language
to	O
print	O
useful	O
error	O
messages	O
.	O
</s>
<s>
Another	O
example	O
is	O
duck	B-Application
typing	I-Application
,	O
where	O
the	O
type	O
of	O
an	O
element	O
can	O
change	O
depending	O
on	O
context	O
.	O
</s>
<s>
The	O
design	O
of	O
an	O
AST	O
is	O
often	O
closely	O
linked	O
with	O
the	O
design	O
of	O
a	O
compiler	B-Language
and	O
its	O
expected	O
features	O
.	O
</s>
<s>
These	O
requirements	O
can	O
be	O
used	O
to	O
design	O
the	O
data	B-General_Concept
structure	I-General_Concept
for	O
the	O
AST	O
.	O
</s>
<s>
To	O
support	O
compiler	B-Language
verification	O
it	O
should	O
be	O
possible	O
to	O
unparse	O
an	O
AST	O
into	O
source	O
code	O
form	O
.	O
</s>
<s>
The	O
AST	O
is	O
used	O
intensively	O
during	O
semantic	O
analysis	O
,	O
where	O
the	O
compiler	B-Language
checks	O
for	O
correct	O
usage	O
of	O
the	O
elements	O
of	O
the	O
program	O
and	O
the	O
language	O
.	O
</s>
<s>
The	O
compiler	B-Language
also	O
generates	O
symbol	B-Application
tables	I-Application
based	O
on	O
the	O
AST	O
during	O
semantic	O
analysis	O
.	O
</s>
<s>
A	O
complete	O
traversal	O
of	O
the	O
tree	B-Application
allows	O
verification	O
of	O
the	O
correctness	O
of	O
the	O
program	O
.	O
</s>
<s>
AST	O
differencing	O
,	O
or	O
for	O
short	O
tree	B-Application
differencing	O
,	O
consists	O
of	O
computing	O
the	O
list	O
of	O
differences	O
between	O
two	O
ASTs	O
.	O
</s>
