[stringtemplate-interest] Automatic generation of "StringTemplate"s from antlr grammar?
Terence Parr
parrt at cs.usfca.edu
Thu Nov 19 12:31:03 PST 2009
Hi Anthony,
Well, yes, you can automatically generate templates but the contents of those templates is an unknown. you would need to tell the tool what you want in there. If it's just a repetition of the input, then use a parse tree (not an AST) or my TokenRewriteStream.
Ter
On Nov 19, 2009, at 5:40 AM, Anthony Anjorin wrote:
> Hello,
>
> I’m a phd-student (TU-Darmstadt, Germany) doing research in the area of MDSD/MDA.
>
> Code generation is an important issue for us and I’m VERY excited to have discovered the antlr and StringTemplate projects.
>
> As we ultimately aim for bidirectionality, I have the following question:
>
> Do you think automatically generating a set of „Stringtemplate“s from an antlr grammar is feasible? My goal is to start with an antlr grammar specifying a certain language, and generate a lexer+parser that produces an AST from a concrete programme. I also want to be able to „unparse“ the AST to obtain the exact (or corresponding) code that (would) produce(d) it (possibly after changing the AST).
>
> As the (programming) language is to be variable, I want to demand as little input as possible – the best case would be solely an EBNF-like grammar (== antlr grammar file). Demanding a set of StringTemplates as well seems redundant in this case, as the source and destination languages are exactly the same (this might seem strange but makes sense in our context J )!
>
> It would be fantastic to be able to automatically generate a parser AND an unparser for the same language, directly from the same antlr grammar - What do you think? Has this possibly been done already? Do you forsee any stumbling blocks? Is it somehow trivial and I’m just a dunce? J
>
> Thanks in advance for your replies,
> Anthony Anjorin.
>
>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
More information about the stringtemplate-interest
mailing list