[antlr-interest] postmortem
Richard Clark
rdclark at gmail.com
Wed Mar 12 19:26:55 PDT 2008
On Wed, Mar 12, 2008 at 12:21 PM, Benjamin Shropshire
<shro8822 at vandals.uidaho.edu> wrote:
> If someone who knows, thinks this is correct, could you add it to the
> wiki in some suitably prominent place?
>
> ANTLR is a tool for generating a number of different kinds of language
> recognizer/translator programs. It is typically used to process input in
> three stages. The first stage takes a characters stream as input, breaks
> it up into tokens (the smallest grouping a language cares about) and
> generates a tokens stream as output. The second stage takes this token
> stream and find's it structure. In this stage, the sequence of tokens is
> converted into a condensed, normalized form, the Abstract Syntax Tree
> (AST), by extracting parts of the input pattern and applying rewrite
> rules. The third step (or steps in some cases) takes this AST and uses a
> tree parser to processes it to do whatever the user needs. This step
> often takes the form of multiple tree parsers that are run in sequence
> to generate the needed results. The first two steps are typically
> defined together in a combined grammar with an output type of "AST".
> Also they should generally have no more action code attached to them
> than is needed to properly parse the input. The bulk of the logic should
> be put in the third step(s).
I took what you wrote and used it for the basis of multiple changes to
http://www.antlr.org/wiki/display/ANTLR3/Five+minute+introduction+to+ANTLR+3
In particular, see "What exactly does ANTLR 3 do?" at the top of the
page and the last paragraph of "Your five minutes are up!" at the
bottom.
There's still room for improvement for the first-time somebody picks
up ANTLR, but I wanted to get something into place without making
drastic changes to the Wiki. A lot of people have put a lot of work
into the pages there and I wanted to respect that.
...Richard
More information about the antlr-interest
mailing list