[antlr-interest] Re: upper, lower case for tokens, rule names

lgcraymer lgc at mail1.jpl.nasa.gov
Fri Jul 18 11:29:12 PDT 2003


Ter--

I wrote this once, had yahoo throw me into the ether.  I prefer the 
current approach, not only for visual effect (which is pretty 
important--highlighting is not an option for black-and-white text) but 
for catching rules moved from one type of grammar (lexer, parser, tree 
walker) to another.  In the current scheme, moving a lexer rule is a 
clear error as is moving a parser/treewalker rule into a lexer.  
Parser and treewalker rules are handled by indeterminacy warnings when 
moving parser rule to treewalker, and by finding an unexpected "#(" in 
a parser grammar.  [I point out that it is occasionally correct to 
move rules and edit them to fit--that's a "feature" of being able to 
parse in the lexer.]

I expect that the current distinction is also a help in a classroom 
situation--it does clearly distinguish tokens from parser rule 
references, and that has to help those unfamiliar with language 
translation concepts.

--Loring


--- In antlr-interest at yahoogroups.com, Terence Parr <parrt at c...> 
wrote:
> 
> On Friday, July 18, 2003, at 10:40 AM, mzukowski at y... wrote:
> 
> > It is nice to be able to distinguish tokens from rule names 
visually, 
> > mainly
> > because tree operators function differently on tokens vs rules.  
As 
> > long as
> > a syntax highlighter could figure it out pretty easily then it's 
ok 
> > with me.
> 
> True.  Also, some people I know use a special char to indicate 
instance 
> variable etc...  perhaps some people would choose a special char or 
> other pattern for token names like tkIdentifier, tkDecl, etc...  or 
> rProgram, rExpr, rAtom.
> 
> 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