[antlr-interest] Simple (should be) lexer Q
Gerald B. Rosenberg
gbr at newtechlaw.com
Fri Jun 10 11:51:59 PDT 2005
At 11:17 AM 6/10/2005, Terence Parr wrote:
>On Jun 10, 2005, at 9:47 AM, Gerald B. Rosenberg wrote:
>
>Hi. What does the -traceLexer option tell you?
At the office at the moment. Will try it tonight. (Can this be set as an
option in the grammar file? Also, just discovered that the Eclipse plugins
are using 2.7.4. Will that make any meaningful difference?)
> I guess you're
>saying that it never chooses the 2nd alternative.
That is what appears to be happening. Removing the first alternative
results in every NAME token containing a single word.
>What is your k
>level?
10
>Is WS a single char or can it be multiple?
Effectively single. For testing purposes, the source text is known to have
only a single space between words.
WS:
( ' '
| '\t'
| ( "\r\n" | '\r' | '\n' )
{ newline (); }
)
{ $setType(Token.SKIP); }
;
>Ter
>
>>NAME:
>> ( CAPWORD (WS CAPWORD)* COMMA WS CAPWORD ) => CAPWORD (WS
>>CAPWORD)* COMMA WS CAPWORD
>> | ( CAPWORD (WS CAPWORD)+ ) => CAPWORD (WS CAPWORD)+
>> | CAPWORD
>>;
>>
>>
>>protected
>>CAPWORD:
>> UPPERLETTER (LETTER)* (PERIOD)?
>>;
>>
>>protected
>>LETTER:
>> UPPERLETTER | LOWERLETTER
>>;
>>
>>protected
>>UPPERLETTER:
>> 'A'..'Z'
>>;
>>
>>protected
>>LOWERLETTER:
>> 'a'..'z'
>>;
>>
>>protected
>>PERIOD '.';
>>
>>----
>>Gerald B. Rosenberg, Esq.
>>NewTechLaw
>>285 Hamilton Avenue, Suite 520
>>Palo Alto, CA 94301-2576
>>
>>650.325.2100 (office) / 650.703.1724 (cell)
>>650.325.2107 (fax)
>>
>>www.newtechlaw.com
>
>--
>CS Professor & Grad Director, University of San Francisco
>Creator, ANTLR Parser Generator, http://www.antlr.org
>Cofounder, http://www.jguru.com
----
Gerald B. Rosenberg, Esq.
NewTechLaw
285 Hamilton Avenue, Suite 520
Palo Alto, CA 94301-2576
650.325.2100 (office) / 650.703.1724 (cell)
650.325.2107 (facsimile)
www.newtechlaw.com
CONFIDENTIALITY NOTICE: This email message (including any attachments) is
being sent by an attorney, is for the sole use of the intended recipient,
and may contain confidential and privileged information. Any unauthorized
review, use, disclosure or distribution is prohibited. If you are not the
intended recipient, please contact the sender immediately by reply e-mail
and delete all copies of this message and any attachments without retaining
a copy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20050610/36546272/attachment.html
More information about the antlr-interest
mailing list