[antlr-interest] ast validation question

Scott Amort jsamort at sympatico.ca
Wed Feb 22 19:11:41 PST 2006


Hello All,

I am writing a parser library for a relatively simple textual
description language, and have progressed fairly well given my relative
lack of familiarity with compiler tools like ANTLR.  This list and the
sample code and grammars provided have been very helpful.

At this point, I have a functioning lexer and parser, and am now working
on a tree walker for validation purposes.  I am hoping to get some
opinions on how best to approach this - currently, I envision using the
tree walking phase to first validate type, then data.  The language
allows tags ( i.e. a '\' followed by text, e.g. \start or \stop).
Currently the lexer identifies the alphanumeric portion after the
backlash as a token and sends it on to the parser, which makes sure it
is found in the correct spots.  Now, in the tree walker, I would like to
make sure that this tag is valid.  Is there an ANTLR-specific way to
accomplish this?  Or perhaps I should develop my own code to deal with
this?  If so, what data structure do you think is best to store a fixed
number of strings, and allow efficient matching or finding?

As you may be able to tell, my programming background is not extensive,
but I am trying to pick up the best way to do things!  Thanks very much
for any assistance.

Best Regards,
Scott



More information about the antlr-interest mailing list