[antlr-interest] translation of $x references in v3.0

Loring Craymer Loring.G.Craymer at jpl.nasa.gov
Sun May 1 16:10:07 PDT 2005


> -----Original Message-----
> From: Scott Stanchfield [mailto:scott at javadude.com]
> Sent: Sunday, May 01, 2005 2:23 PM
> To: 'Loring Craymer'; 'Terence Parr'; 'ANTLR Interest'
> Subject: RE: [antlr-interest] translation of $x references in v3.0
> 
> > Come to think of it, I would suggest considering
> >
> > @id = ID
> > Instead of  id = ID in your example.
> 
> > > [from Ter's post]
> > > a[String s, int x] returns [float y]
> > >    : id=ID f=field {$s, $x, $y, $id, $f.z;}
> > >    ;
> 
> I like that... Makes it easier to read which is a rule or token ref...
> 
> I'd agree with $ being a problem as well... But @ is a problem for the
> same
> reason (perl, for example).
> 
> Sounds like we should let the specifiers be, uh, specified:

Scott--

I started thinking in that direction myself, and then realized "Duh!
Special characters in actions are the responsibility of the ANTLR backend
developer for a given target language".  The ANTLR implementation needs to
provide the hooks for applying the translation, but it is the backend
"action parser" that is responsible for identifying tokens to be translated.

--Loring
  
> 
> options {
>   referencePrefix="$";
>   pluginPrefix="@";
> }
> 
> (the defaults?)
> 
> or
> 
> options {
>   referencePrefix="%";
>   pluginPrefix="~";
> }
> 
> Thoughts?
> -- Scott




More information about the antlr-interest mailing list