[il-antlr-interest: 25400] Re: [antlr-interest] Checking whether an optional rule matched or not

2009-08-22 Thread Achint Mehta
Hi Kevin, The changes suggested by you solved the problem. Thanks. Regards, Achint On Sat, Aug 22, 2009 at 2:43 AM, Kevin J. Cummings < cummi...@kjchome.homeip.net> wrote: > On 08/22/2009 01:46 AM, Mark Wright wrote: > > Hi Achint, > > > > Maybe something like: > > > > first > > @init { bool s

[il-antlr-interest: 25398] Re: [antlr-interest] Checking whether an optional rule matched or not

2009-08-22 Thread Achint Mehta
cribes how to do it with optional tokens, > something like (assuming 'second' is a token): > > first > : (second_rule_matched='second')? third > { >if($second_rule_matched != 0) > cout<<" Second rule matched"< } > ; > >

[il-antlr-interest: 25394] [antlr-interest] Checking whether an optional rule matched or not

2009-08-21 Thread Achint Mehta
Hi All, If I have a option rule in my grammar, how can I check whether that rule matched or not. e.g. if I have a rule in my grammar first: (second)? third { if(/* second rule matched */) cout<<" Second rule matched"

[il-antlr-interest: 25263] Re: [antlr-interest] Resolving ambiguities in Lexer rules

2009-08-16 Thread Achint Mehta
t be improved further ? Thanks. Regards, Achint On Sun, Aug 16, 2009 at 10:45 AM, David-Sarah Hopwood < david-sa...@jacaranda.org> wrote: > Achint Mehta wrote: > > 2. The second option is that all the tokens have to given as alternate > > rules/token with SPECIAL_STR

[il-antlr-interest: 25255] [antlr-interest] Bypassing Lexical phase

2009-08-15 Thread Achint Mehta
Hi All, Is it possible to bypass the lexical phase and jump right onto the parsing phase ? Thanks. Regards, Achint --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, s

[il-antlr-interest: 25254] Re: [antlr-interest] Resolving ambiguities in Lexer rules

2009-08-15 Thread Achint Mehta
do you have keywords that are reserved. Can you say in your > language that Integer is a "type" or is it merely a string and only in > certain contexts does it have a meaning? > > Yes it is restrictive to have reserved words but it makes the parsing much > easier. > >

[il-antlr-interest: 25251] Re: [antlr-interest] Resolving ambiguities in Lexer rules

2009-08-15 Thread Achint Mehta
ses reserved words or not. > I'm not an expert by any means but that doesn't mean I don't have an > opinion just that you should take it with a grain of salt. > > You can either handle this with a symbol table later in the process or > rewrite the requestline to someth

[il-antlr-interest: 25241] [antlr-interest] Resolving ambiguities in Lexer rules

2009-08-14 Thread Achint Mehta
Hi All, The section "Ambiguities and Non determinisms" of the book "The definitive ANTLR guide" talks about the ambiguities in lexer rules, but I am not sure how to resolve them. Consider a following grammar which assigns a value to an ID. The ID can either be VERSION or COUNT while its value can

[il-antlr-interest: 25219] Re: [antlr-interest] Extracting a string whose value clashes with token value

2009-08-13 Thread Achint Mehta
nes as to what rules should be lexer rules and what should be parser rules ? Thanks! Regards, Achint On Wed, Aug 12, 2009 at 11:07 PM, Achint Mehta wrote: > Hi Benoit, > > The solution suggested by you solved the problem. > > Many thanks. > > Regards, > Achint > > &

[il-antlr-interest: 25192] Re: [antlr-interest] Extracting a string whose value clashes with token value

2009-08-12 Thread Achint Mehta
rder with which you > define tokens, so make sure you put ANTLRTOKEN above SPECIAL_STRING. > > > On Wed, Aug 12, 2009 at 7:34 AM, Achint Mehta wrote: > >> >> Hi, >> >> I am stuck at a seemingly trivial problem. >> I have written a simplified sample gramm

[il-antlr-interest: 25149] [antlr-interest] Extracting a string whose value clashes with token value

2009-08-11 Thread Achint Mehta
Hi, I am stuck at a seemingly trivial problem. I have written a simplified sample grammar which has this issue. In the grammar I have a rule to extract a generic string special_string: (CHAR | '=' | '.' | '-' | '@' )+ ; and a token ANTLR which is defined as: ANTLRTOKEN:'ANTLR'; A rule which par