[antlr-interest] Re: can a tree grammar and the ANTLR toolkit be used to write genrative libraries

aaanwar aaanwar at yahoo.com
Fri Apr 25 15:23:13 PDT 2003


Yes,

That is along the lines of what I was thinking if.

As ANTLR takes grammar definitions and churns or parsers I want to 
take the same grammar definitions and churn out APIs that can be used 
generate source in any given language.

I was surprised to find nothing readily available for this purpose 
given the number of tasks machine generation of source code is 
needed ... idl compilers, GUI builders, etc.

I would be interested in working on such a project. Let me know if 
you think ANTLR should be extended in this fashion or a new project 
needs to be started.

Arman.

 --- In antlr-interest at yahoogroups.com, Terence Parr <parrt at j...> 
wrote:
> 
> On Thursday, April 24, 2003, at 05:20  PM, aaanwar wrote:
> 
> > Greetings,
> >
> > This is a refinement of an earlier question:
> >
> > What I really want to be abel to do is programatically generate 
code
> > in say java.
> >
> > So I would like to do something like.
> >
> > CompilationUnit cu = new CompilationUnit();
> > cu.addClass("HelloWorld")
> >   .addMethod( "main", PUBLIC | STATIC | , VOID);
> >
> > and so forth ...
> 
> Hi...I have essentially what you want, but it's not ready to be 
> released. :(  You want a template like creature:
> 
> method ::= <<
> <access> <returnType> <name>(<args:argumentDecl()>) {
>      <slist:statement()>
> }
>  >>
> 
> I haven't figured out what to do with StringTemplate yet and I need 
to 
> make it work better for ANTLR stuff.  Mainly used  now to generate 
web 
> pages for jGUru and peerscope :)
> 
> Ter
> --
> Co-founder, http://www.jguru.com
> Creator, ANTLR Parser Generator: http://www.antlr.org
> Co-founder, http://www.peerscope.com link sharing, pure-n-simple
> Lecturer in Comp. Sci., University of San Francisco


 

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




More information about the antlr-interest mailing list