Support StringTemplate, ANTLR Project by making a donation! Terence often pays for things like the antlr.org server, conference travel, and this site design (that alone cost US$1000). Buy him a beer and pizza remotely ;)
|
Stuff I do like in ANTLR 2
Updated March 10, 2004
We have an "ANTLR 2 Bashing" list so we can try to fix stuff that we don't like, but we also need a list of stuff we like so as not to break a good "recipe." :)
Terence Parr
- Human readable code; i.e., I like recursive-descent parsers
- ANTLR is mostly understandable in its fundamental structure / behavior
- k>1 is good
- Predicates add power to LL
- ANTLR code is easy to fold into applications for the most part
- ANTLR generates parsers in multiple languages
- Simple annotations can tell antlr how to make ASTs
- Tree parsers
- consistent syntax among lexer, parser, tree parser
- LL(k) based lexers (this is a love hate thing)
- TokenStreams
- Exceptions for error handling
John Mitchell
- Readability of the generated code.
- Syntactic and semantic predicates.
- Permissive licensing.
- This mailing list and the people that make it so valuable.
- All of the people who have contributed so many grammars, etc.
Loring Craymer
- Actions are invoked in a civilized manner.
- ANTLR-style trees are an aid to language transformation.
- Labels, rule arguments, and return values help with semantic processing.
- Encapsulating generated code in classes is very clean.
Monty Zukowski
- Human readable code. Still the best way to learn what is going on inside.
- Solid theoretical basis. Way beyond your typical LL parser generator.
- Does smart things for k>1. So many possibly cool tools limit themselves to
LL(1) and ignore real problems.
Robin Debreuil
- It actually works - this is not a minor consideration. Works very well in
fact, and all of it.
- It is simple enough that you can get useful work done within a few days,
and pursue the finer points over time.
- Cross platform (C++, C# versions), and cross OS (java based)
- It is free to use, and to modify little things to suit your specific needs
(er, I think!)
- The grammar markup is consistant - a few concepts will generally apply the
same way in different situations (eg, ! applies to a rule, a choice, a
subrule, a Token - similar with labels etc.)
- The ability to insert native code anywhere, and actually see what it is up
to (in a grok-able context) in the output.
- The syntax and concepts are similar across Lexer, Parser, and Tree walker
- The generated code is easy to understand, conceptually as well, so it
isn't a 'magic' blackbox step.
- There is a lot of underlying prewritten goodness that can help you out, at
your option. Nothing is forced on you.
- You have near total control over what the generated tree looks like, and
things like hetrogeneous trees are not an all or nothing option.
- It is complete across stages - eg. it isn't a lexer with a parser quickly
tacked on, so one program, one set of concepts, no gluing chunks together.
- Documentation is quite good for those just starting out, with plenty of
sample files.
- LL(k)
- It is similar enough to ebnf etc. that such documents remain very useful
- Grammars are easy to read, navigate and modify (as opposed to say regular
expressions etc). Doing things like moving a task from the Lexer to the
Parser is trivial.
- Option to use it as a (uber) filter is great
- Multiple contributors are welcomed, feedback is solicited, improvment is
ongoing
- The 'culture' around the program is very generous, encouraging and smart -
and tolerant of newcomers :).
- There is a great mailing list (filled with the above people) with a
searchable archives.
- There is a central up to date site with the latest news, tutorials,
grammars, and oh yes, that picture. Mostly it all comes down to that
picture.
Sriram Srinivasan
- Readable generated code. I'm uncomfortable with tools that do things for me in ways I don't understand.
- Readable code makes it easy to profile a parser.
- Recursive descent parsing feels intuitive to me. k > 1 makes it practical
- Passing parameters and results is so simple.
- The civility and approachablility of the people working on and with it.
- Open liicensing scheme, no scary copyrights.
- Predicates
- Similar scheme for scanning characters, tokens, trees.
- Written in java. It is a pleasure to build a 3rd party product with
jikes *.java */*.java */*/*.java
Try compiling Flex or Bison for windows.
- Token stream pipelines.
- Lots of people use it, so no effort spent in evangelization within
your own company.
Matthew Ford
|