Related articles |
---|
newbie questions about AST felixmish@usa.net (Felix Mish) (1998-10-05) |
Re:newbie question on AST KPRASAD@us.oracle.com (KPRASAD.US.ORACLE.COM) (1998-10-17) |
From: | "KPRASAD.US.ORACLE.COM" <KPRASAD@us.oracle.com> |
Newsgroups: | comp.compilers |
Date: | 17 Oct 1998 01:45:58 -0400 |
Organization: | Compilers Central |
References: | 98-10-036 |
Keywords: | AST |
You need to construct a data structure that will hold all function
calls and their corresponding stacks. Pascal/C/C++ will have a tree
of stacks as the AST for procedure calls. Each node in a tree will
contain a stack of all variables defined within the function. If a
variable outside the scope of the function is refered, then we look at
the parent node 's stack and so on. if in the while loop, you are
defining variables, then its like a nested function call. A *while*
will be a node that has an expression evvaluation subtree and on
evaluation that will lead to loop/end-of-loop .
-kamal
Return to the
comp.compilers page.
Search the
comp.compilers archives again.