[antlr-interest] lexer: compound keywords with a twist

Edwards, Waverly Waverly.Edwards at genesys.com
Sun Aug 19 19:28:49 PDT 2007


stringVar = Edit$( vNumParam ) 
 
Sorry, vNumParam is actually a variable number of parameters ( up to 5
).
 
 
W.

________________________________

From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Edwards, Waverly
Sent: Sunday, August 19, 2007 8:52 PM
To: antlr
Subject: [antlr-interest] lexer: compound keywords with a twist




Hello, 

I'm a first time ANTLR user and I have some questions that I need some
assistanc with. 
I am replicating an existing procedural BASIC dialect language compiler.
I actually have 
multiple issues to overcome but this is the first one.  The language has
*hundreds* of keywords. 
Many of the keywords are actually compound keywords 

Edit = numericVar 
Edit Field 
Edit Field Close 
Edit Menu 
Edit Text 
Compile Long If 


1.  How would you define compound keywords?  The keyword "Edit" has 5
different starts 
and the longest usage is a combination of three words 


2.  Is it possible to deal with variable length keywords at the lexer
level. 

stringVar = Edit$( vNumParam ) 
Edit$( vNumParam ) = stringVar 

I have two instances where Edit$ ( different from Edit ) can be used.
One as a function 
and the other a procedure.  If Edit$ is on the left side of a variable
it's a procedure and 
if on the right it's a function.  The perform different tasks.  Is there
a way at the lexer 
level that I can pass the parser something like EditStatement vs
EditFunction depending 
on what the lexer sees first. 

Thank you, 


W. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070819/ac9a60a7/attachment.html 


More information about the antlr-interest mailing list