[antlr-interest] Parsing VB-like Language Part 1: REM
mzukowski at yci.com
mzukowski at yci.com
Tue Jun 24 09:43:42 PDT 2003
Don't worry about it. Your syntactic predicate is not in a loop so it
shouldn't be a big impact.
Monty
-----Original Message-----
From: Matthew Douglass [mailto:mdouglass at exapted.com]
Sent: Tuesday, June 24, 2003 9:05 AM
To: antlr-interest
Subject: [antlr-interest] Parsing VB-like Language Part 1: REM
I'm fairly new to antlr, having written only one parser (that was
heavily borrowed from the java.g example). I am working on parsing a
VB-like language, and am having problems with comments that start with
rem. They are, obviously I'm sure, causing non-determinism warnings
with my IDENT definitions. I have found a way to fix it, by doing the
rem parsing inside the IDENT literal using a semantic predicate (I think
that's the right term) as follows:
IDENT
options {testLiterals=true;}
: ( ("rem" WS_NONBREAKING) => "rem" WS_NONBREAKING
(~('\n'|'\r'))* ('\n'|'\r'('\n')?) {$setType(Token.SKIP); newline();}
| ('a'..'z'|'_') ('a'..'z'|'_'|'0'..'9')* (TYPE_CHARACTER)?
)
;
But my understanding is that this would slow down my lexing quite a bit
-- is there a better way to do this? Or should I just not worry about it?
Thanks for any advice you can offer,
Matthew Douglass
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list