[antlr-interest] Re: ANTLR 3.0 and code generation for C++

Terence Parr parrt at cs.usfca.edu
Mon Oct 27 15:56:22 PST 2003


On Monday, October 27, 2003, at 03:41 PM, katre wrote:

> lgcraymer wrote:
>> The 3.0 code generator will look very different from the 2.x code
>> generators.  It will be driven by an output grammar, with
>> language-specific implementations of the output templates.
>> Retargeting output to another language should be relatively easy (1000
>> LOC versus the current 150,000 LOC).
>
> How generalized will this be?  So far, with ANTLR 2.x, code is only
> generated for OO languages (Java, C++, C#).  I know there was another
> output in the past (Haskell?) but will ANTLR be able to target more
> functional languages?  My specific favorite target would be OCaml, 
> which
> I find I am using more the more I get to know it, but the included 
> lexer
> and parser generators are basically translations of lex and yacc and
> lack a lot of features I got used to when using ANTLR.

I expect two paths.  If your language is an algol derivative like most 
imperative languages, you should just be able to tell me what assign, 
function call, etc... looks like and it will just work.  Should be ok 
for non-OO stuff like C too.  For wacky stuff like lisp and ocaml, I 
should be able to provide a good framework that doesn't take much 
effort, but it will require some coding / understanding of ANTLR.  The 
imperative languages should be implementable with no coding or almost 
no coding.

It is my dream to do all of the code functionality with ANTLR and then 
simple ask code generators how to do the very mundane tasks of coding 
in that target language.  So if I fig a code gen bug in ANTLR's tree 
action generation, it will fix it in each target.  The only other issue 
is that the libraries will have to be built.  The new version will have 
an exact spec so you know what to build and how it should all work 
together.

Ter
--
Professor Comp. Sci., University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Co-founder, http://www.jguru.com
Co-founder, http://www.knowspam.net enjoy email again!
Co-founder, http://www.peerscope.com pure link sharing




 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list