[il-antlr-interest: 31857] Re: [antlr-interest] Ambiguity in grammar

2011-03-21 Thread Kevin J. Cummings
On 03/21/2011 12:26 AM, Wojciech Tomasz Cichon wrote: i have in my grammar rules: stmt : | ident '=' lexp SEMI - ^(SET ident lexp); factor : '-'? (NUMBER |ident )^ ; and lexp : term (SIMOP^ lexp)?; term : factor (OP^ term)?; OP : '*' | '/' |

[il-antlr-interest: 31859] Re: [antlr-interest] Grammar issue

2011-03-21 Thread maulattu
Hi all, for a matter of convenience I didn't write here all the rules for white spaces and so on, but I've them in order to skip white spaces, tab, \r, \n and so on. It seems the lexer recognize as textLiteral the parameter names (i.e.: VARIABLE and MESSAGE_). Any suggestions? Thank you all :)

[il-antlr-interest: 31860] [antlr-interest] Problem with grammar

2011-03-21 Thread Wojciech Tomasz Cichon
hi, i have prioblem with one rule from my grammar factor ... | ident '('( ident_arg (ident_arg2)*)? ')' - ^(CALL ident ^(PARAMS (ident_arg ( ident_arg2 )* )?)) after i send line : c = 2*a+ f(1,4); i received error: line 17:11 mismatched input '1' expecting ')' it looks like it’s completely

[il-antlr-interest: 31861] Re: [antlr-interest] Problem with grammar

2011-03-21 Thread Matt Fowles
Wojciech~ Not sure what the issue is; however, I might suggest that the rule function_call : ident '(' (ident_arg ( ident_arg2 )* )? ')' SEMI - ^(CALL ident ^(PARAMS (ident_arg ( ident_arg2 )* )?)); is better written function_call : function_ref '(' (arg (',' arg)*)? ')' SEMI - ^(CALL

[il-antlr-interest: 31862] [antlr-interest] How to Read ANTLR Ambiguous Path Visualization?

2011-03-21 Thread Martin Becker
Hi there, I'm new to grammars and ANTLR(Works) and having a problem now. I understand there is some disambiguity in my grammar, but due to lack of documentation of the 'Ambiguous Path Visualization' in ANTLRWorks, I don't understand what it is trying to tell me. Please have a look at this

[il-antlr-interest: 31863] Re: [antlr-interest] How to Read ANTLR Ambiguous Path Visualization?

2011-03-21 Thread Peter Kooiman
Hi Martin, It's telling you that when when it recursively enters ruleExpression after ruleUnOp, on encountering [ at the end of the recursive ruleExpression it cannot decide if ruleSelector is part of the recursive invocation of ruleExpression or of the invoking ruleExpression. Because of the

[il-antlr-interest: 31864] Re: [antlr-interest] Grammar issue

2011-03-21 Thread Jim Idle
Take the 'literals' out of the parser and create real lexer tokens that are declared before the other, more general tokens. Using literals in the parser confuses you and will also make error handling and tree walking more difficult. Jim -Original Message- From:

[il-antlr-interest: 31865] Re: [antlr-interest] Problem with grammar

2011-03-21 Thread Jim Idle
The nested ^ are fine but without a subrule, the node will not have start and stop indexes correctly updated. The main problem with this grammar is that it has no structure and it looks like it is ambiguous. First remove the 'literals' and make real tokens, then start with one of the simpler

[il-antlr-interest: 31866] [antlr-interest] @ Jim Idle: ANTLR3 C generation

2011-03-21 Thread Udo Weik
Hello Jim, don't want to bother you, but did you get my email dated 03/16/2011 - Re: ANTLR3 C generation? Only want to be sure that you got it! Thanks and greetings Udo List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe:

[il-antlr-interest: 31867] Re: [antlr-interest] How to Read ANTLR Ambiguous Path Visualization?

2011-03-21 Thread Jim Idle
looks like ruleunop should be one level higher in the expression tree. Are you trying to type in a grammar straight from a spec by any chance? Specs are rarely written in LL(k) form as they are more descriptions of a language perhaps for programmers and so on, but not usually for parser writers.

[il-antlr-interest: 31868] [antlr-interest] How to ignore TOKEN in a String

2011-03-21 Thread Hiten R
Hi All, ANTLR grammar acts funny when it encounters a TOKEN in a String. How should I make the ANTLR escape the letter found in the String is not a TOKEN. Help will be appreciated. Thanks Hiten Example text_content.txt funny boys are Tom Hardy Donald serious guys are not funny either grammar

[il-antlr-interest: 31869] Re: [antlr-interest] How to ignore TOKEN in a String

2011-03-21 Thread John B. Brodie
Greetings! On Mon, 2011-03-21 at 10:00 -0700, Hiten R wrote: Hi All, ANTLR grammar acts funny when it encounters a TOKEN in a String. How should I make the ANTLR escape the letter found in the String is not a TOKEN. Help will be appreciated. Thanks Hiten Example text_content.txt

[il-antlr-interest: 31870] [antlr-interest] Strip tool

2011-03-21 Thread Sunil Sawkar
Hi, I would like to use the Strip tool to remove action code from my grammar. I saw reference to this tool in antlr version 3.1.2. I currently use antlr version 3.2. Can anyone help me find this tool / show how to use it from the jar package for antlr-3.2 ? Or is this a separate entity that