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

Edwards, Waverly Waverly.Edwards at genesys.com
Sun Aug 19 17:52:01 PDT 2007


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/446baa73/attachment.html 


More information about the antlr-interest mailing list