[antlr-interest] Re: Enhance ANTLR support for comments?

Terence Parr parrt at cs.usfca.edu
Fri Jul 18 13:45:53 PDT 2003


On Friday, July 18, 2003, at 01:27 PM, micheal_jor wrote:
> One complicating issue is that depending on the constraints of
> execution environment, I might want a compact or even more compact
> representation of these. For instance, I might want to shoehorn both
> the line and column numbers into a single 32-bit integer (16:16 or
> 24:8 split) or leave them as two separate integers.
>
> Not sure how ANTLR 3 can support such scenarios easily.

One of the thoughts we had in the cabal was that you would specify the 
token attributes in an ANTLR formalism and the code generator would be 
able to decide how to encode in the target language.  For example, you 
might do

token {
   // text and type predefined perhaps
   int start;
   int stop;
   String filename;
}

At NeXT I had to encode token type and line number into a 32 bit int, 
but in other cases it had to be an object.  The code generator could 
generate either depending on options and what attributes you had in 
there.

Just some thoughts we had.  We're thinking about language independence 
pretty heavily since I expect to make building a code generator for 
ANTLR pretty easy.  Lots of back ends will appear I hope.  I'm going to 
go so far as to have a text-based intermediate form (if wanted) so that 
you don't even have to build the code generator in ANTLR.  You could 
build the python code generator in python for example as it's just 
reading a text file with all the "hard parts" filled in :)

Terence
--
Professor Comp. Sci., University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Co-founder, http://www.jguru.com
Co-founder, http://www.knowspam.net enjoy email again!
Co-founder, http://www.peerscope.com pure link sharing




 

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




More information about the antlr-interest mailing list