[antlr-interest] literal has no associated lexer rule...
Yurushkin Michael
wotker at rambler.ru
Wed May 13 00:17:03 PDT 2009
Thanks!
Jim Idle <jimi at temporal-wave.com> писал(а) в своём письме Wed, 13 May 2009
01:45:11 +0400:
> Yurushkin Michael wrote:
>> Good day!
>> I use Antlr 3.
>> There are 2 grammar files (lexer and parser). Lexer contains tokens
>> definitions and parser imports tokens tabel.
>> Is it possible to avoid definition of all literals (such as '+', '-'
>> etc)...
>>
>> I want to write such rules in parser:
>> "expr : (expr '+' factor) | (expr '-' factor) | factor;"
>>
>> but the "literal has no associated lexer rule: '+'" error appears.
>>
> No, you need to define the literals in the lexer and use tokens rather
> than literals in the parser. When you come to print error messages and
> so on, you wil likely want this anyway.
>
> Jim
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
> __________ Èíôîðìàöèÿ îò ESET Smart Security, âåðñèÿ áàçû äàííûõ
> ñèãíàòóð âèðóñîâ 4069 (20090512) __________
>
> Ñîîáùåíèå ïðîâåðåíî ïðîãðàììîé ESET Smart Security.
>
> http://www.esetnod32.ru
>
>
>
--
Написано в почтовом клиенте браузера Opera: http://www.opera.com/mail/
More information about the antlr-interest
mailing list