[antlr-interest] searching the AST

Mo m.axmed at gmail.com
Thu Jul 13 12:10:31 PDT 2006


Hi all,
  i was wondering if any one could suggest what the best way to search
the AST tree when walking it.

I have code in the form of

variable = foo(bar);

and somewhere else in the code i the declaration for foo, i.e:

function foo(bar){
  return "blah";
}

I can already parse and evaluate expresions that appear in their 'use' order.

However, i'd prefer that during the interpretation process, when the
TreeParser encounters a function call, for it to be able to look
through the whole tree to determine whether the function referred to
exists, if it does load it as the current sub-tree to process and
process it, the return control to the point where the function call
occurred.


 and as always much appreciated

cheers,
mo


More information about the antlr-interest mailing list