[antlr-interest] StringTemplate is Ok, but what about "Action code"?

Harald M. Müller harald_m_mueller at gmx.de
Wed Nov 28 22:48:41 PST 2007


Ah yes - you are right! - so what we need is a "generic language" for
expressing

* special actions on the token level - string handling
* special actions in the grammar - lookaheads
* special actions for tree building - when you want to build "something
special"

and some way of translating that generic language to whatever action target
language we want - don't we? This sounds possible (????? - not thought more
than 5 seconds about it, I confess), even if it's some hard work. But if
someone throws together many ANTLR3 grammars and looks for the code, maybe
something could come out ... (even if - as an afterthought - it is found
it's NOT possible ;-) ).

Regards
Harald

> -----Original Message-----
> From: Loring Craymer [mailto:lgcraymer at yahoo.com] 
> Sent: Wednesday, November 28, 2007 7:07 PM
> To: Harald Mueller; Cristian Peraferrer; antlr-interest at antlr.org
> Subject: Re: [antlr-interest] StringTemplate is Ok, but what 
> about "Action code"?
> 
> Harald--
> 
> I suspect you misinterpreted Cristian's question.  It is not 
> uncommon to find a need use the same grammar with multiple 
> target languages, or (more commonly) to want to take a 
> grammar that someone developed for an application written in 
> one target language, say C++, to use for a second target 
> language such as Java.  If you have to modify the actions in 
> the grammar, you end up with two copies of the grammar that 
> need to be kept in synch and the start of a maintenance nightmare.
> 
> --Loring
> 
> 
> ----- Original Message ----
> > From: Harald Mueller <harald_m_mueller at gmx.de>
> > To: Cristian Peraferrer <corellian.c at gmail.com>; 
> > antlr-interest at antlr.org
> > Sent: Wednesday, November 28, 2007 7:15:41 AM
> > Subject: Re: [antlr-interest] StringTemplate is Ok, but 
> what about "Action code"?
> > 
> > Hi -
> > 
> > Why would you want to do this?? - whatever you do in 
> actions, you need
> > 
>  to express some sort of "algorithm." I do not see another
> > possibility
> > 
>  than to have SOME language that will express what you need. Java
> > is
> > 
>  perfect: It will decouple you (they say) from any plat form
> > specifics,
> > 
>  because you write it once, and it runs everywhere ;-)
> > 
> > If you do not believe this, you must invest in your own 
> infrastructure
> > 
>  for this: Define a language (generic bytecode? Turing
> > machine
> > 
>  statements ;-) ?) and deliver in-process compilers which 
> will transform
> > your
> > 
>  selected language to something running on the target system.
> > 
> > Not even low coupling with the target language is a worthwhile
> > 
>  consideration most times, isn't it? - except for meta-tools like e.g.
> > ANTLR
> > 
>  itself.
> > 
> > Regards
> > Harald M.
> > 
> > 
> > -------- Original-Nachricht --------
> > > Datum: Tue, 27 Nov 2007 16:35:38 +0100
> > > Von: Cristian Peraferrer
> > > An: antlr-interest at antlr.org
> > > Betreff: [antlr-interest]  StringTemplate is Ok,    but what
> > about
> > 
>  "Action code"?
> > 
> > > Hi,
> > > 
> > > With StringTemplate we can achieve low coupling with the target 
> > > language. But what about Action code?
> > > How we should achieve low coupling with the target language?
> > > 
> > > Thanks in advance,
> > > Cristian.
> > > 
> > > --
> > > GPG Key-ID: 0x564903FA - Jabber ID: corellian at swissjabber.ch
> > 
> > --
> > Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
> > Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
> > 
> 
> 
> 
> 
>       
> ______________________________________________________________
> ______________________
> Get easy, one-click access to your favorites. 
> Make Yahoo! your homepage.
> http://www.yahoo.com/r/hs 
> 



More information about the antlr-interest mailing list