[antlr-interest] Re: Seperating Grammar and Actions..

cintyram <cintyram at yahoo.com> cintyram at yahoo.com
Tue Jan 14 07:18:34 PST 2003


 
> I'm cool with the general idea of a stripped down IR (e.g. all 
> looping constructs collapsed into 'for' in C) but some of the CIL 
> transforms are....well scary  ;-).
..

Leaving  the penchant for genericity aside for a moment , if we
consider teh real world, teh reason any one would want to start
writing a grammar is to solve an immediate problem. teh chances of
extension might not be apparent then [ sarcastic .. but a java grammar
with different actions , actions here is a broad brush for the whole
gamut of things that happens after the parsing or token stream
identification,  could be used for a game!! ] 
While im all for the ability to generate a tree with the parser
itself, developing our own tree gives us more flexibility .
since we any way have to do multiple passes to get something done, a
different set of actions [ lets say a different path ] taken could
result in an entirely different application . if such a different path
seems possible we should already have enough information to make it
even easier. agian we can argue in two ways .. if the first tree [ir]
is always generated by teh tool , we have a standard reference,
alternatively if the ir is generated by us we have enough flexibility
to decide and plan for what exactly suits our applications
possibilities . 
 by properly providing standard components which can still generate
behaviour like what we have now, without a significant loss in cost ,
we can default to one standard behaviour, but by providing our own
componetns we can extend it or over ride it .by seperating action ,
including that of the initial tree constrution , from the grammar we
achieve this decoupling ..
like if there are easy ways of building  binary/m-ary trees instead of 
child -sibling, and appropriate tools for writing those tree grammars
and tree walkers ..wouldnt one want to have an option of specifying
what format of tree to be generated ?

however i still maintain that this should only be an option as, for
almost all practical purposes, the best thing would be to let teh tool
do as much work for us, and get the job at hand done easily.

also seperating action doesnt mean that we can handle only
syntaxdirected etc [ sorry if i was not clear there ]; action ,
atleast what i meant by that term ,is  what ever we do after
recognizing the input  to generate the required output , irrespective
of the number of stages involved.

cheers
ram




 

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



More information about the antlr-interest mailing list