[antlr-interest] A postmortem of my use of antler

Darien Hager darien.hager at etelos-inc.com
Tue Mar 11 15:07:09 PDT 2008


On 3/11/08, siemsen at ucar.edu <siemsen at ucar.edu> wrote:


>
> Wow, I think this question is backwards.  I learned ANTLR from the book as
> I wrote
> a nontrivial translator.  I developed it using the time-honored tradition
> of adding only
> what was needed.  An AST never was, so my translator never grew an AST.
>  Yet it
> does the job very well.  To me, evaluate-as-you-parse is the normal case,
> and the
> question is "what are ASTs good for, other than speeding things up if you
> need
> multiple passes?".
>

My approach is different, since I want to use ANTLR to parse a
scripting/template DSL in web pages. There is no 1:1 translation possible,
since there's a lot of environment stuff involved.

ASTs can be cached, avoiding re-reading the file for each request. ASTs mean
that the language parsing engine is decoupled from the execution engine, so
I only need to rebuild the parser when the language itself changes rather
than for every bugfix. ASTs mean that I don't need to write a whole new
runtime for ANTLR in PHP.

Anyway, the biggest one is decoupling and separation-of-concerns. I just
don't think a grammar is a good place for executable code except where it is
specifically enables understanding (not execution) of the input.
-- 
Darien Hager
Developer
Etelos, Inc.
darien at etelos.com

http://www.etelos.com
"Revolutionizing the way applications are developed, distributed and
consumed."

This e-mail message, including attachments, may contain confidential
information for the sole use of the intended recipient(s). If you are not
the intended recipient, then this is notice that any use, disclosure,
dissemination, distribution or copying is strictly prohibited. If you have
received this message in error please contact the sender by reply mail and
destroy all copies of the original message.

This e-mail message, including attachments, may contain confidential information 
for the sole use of the intended recipient(s). If you are not the intended recipient,
then this is notice that any use, disclosure, dissemination, distribution or copying is 
strictly prohibited.  If you have received this message in error please contact the 
sender by reply mail and destroy all copies of the original message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080311/49271874/attachment-0001.html 


More information about the antlr-interest mailing list