[il-antlr-interest: 33271] Re: [antlr-interest] Deciphering the TreeWalker error message ...

2011-07-21 Thread srinivasan karthikeyan pitchai
Hey Grey, Yes you are absolutely right, the first element is a rule reference. My sclarSubExpression snippet is as follows:- sclarSubExpression : ^(SUB_EXPR ^(sign sse=sclarSubExpression)) | ^(SUB_EXPR expressionWithParen) | ^(SUB_EXPR function) | ^(SUB_EXPR

[il-antlr-interest: 33272] Re: [antlr-interest] Deciphering the TreeWalker error message ...

2011-07-21 Thread Gary Miller
Hey Vasan, Couple of things. 1. My name is Gary not Grey ;-) 2. I'm not really an ANTLR guru. 3. rule :  ^(subrule otherrule) ; Just looks wrong. If you inline (expand) out what you have written you would get compoundExpression : ^((SUB_EXPR ^(PAREN_SCLAR_EXPRESSION sclarExpression+)

[il-antlr-interest: 33274] Re: [antlr-interest] Antlr C target with LibXML

2011-07-21 Thread Ivan Brezina
Hi, try to execute the compiler like gcc -E -P and check the output. Or try to compile the output manually. ANTLR adds a define for each token you declare and these macro definitions do interfere with some datatype present in libxml headers. For example if you create your own token called int in

[il-antlr-interest: 33275] [antlr-interest] Incompatible type in subrules with OR

2011-07-21 Thread Claudio Martella
Hello, I've this grammar: http://pastebin.com/dNzdGx8R but i get this error when I test it with AntlrWorks: [11:23:59] /Users/hammer/output/RDFPathParser.java:383: incompatible types [11:23:59] found : RDFPathParser.repeat_return [11:23:59] required: RDFPathParser.shortestPath_return

[il-antlr-interest: 33276] [antlr-interest] (no subject)

2011-07-21 Thread Roland Sako
Hello, I am Roland Sako from Geneva in Switzerland. I am currently working on a project which I need to generate an expression tree of an Objective-C source code, then I will visit that tree to add extra instruction in it. I just got an Objective-C grammar file from the web

[il-antlr-interest: 33277] [antlr-interest] Left recursive grammar

2011-07-21 Thread Luigi Iannone
Hi all, I have this simple grammar grammar test; options { language = Java; output = AST; } a : a*B -^(B a*) | A ; B : '.B' ; A : 'A' ; and I get the following output when I

[il-antlr-interest: 33278] Re: [antlr-interest] Left recursive grammar

2011-07-21 Thread Bart Kiers
Hi Luigi, I'm not sure if this is possible with ANTLR, or any other LL parser generator. See this for a work-around: http://stackoverflow.com/questions/3799890/antlr-ast-generating-possible-madness If it _is_ possible using some sort of fancy AST rewrite magic, I'm sure someone will correct me.

[il-antlr-interest: 33279] Re: [antlr-interest] Left recursive grammar

2011-07-21 Thread Sam Harwell
Your example is ambiguous as well as left recursive. I assume you meant one of the following: a : a B | A; a : A* B | A; The first can be written as: a : A (B^)*; The second can be written as a : A (A* B^)? | A | B; Sam -Original Message- From: antlr-interest-boun...@antlr.org

[il-antlr-interest: 33280] Re: [antlr-interest] Left recursive grammar

2011-07-21 Thread Bart Kiers
Hi Sam, But of course, with the inline tree rewrite operators it looks so straight forward! Nice one! Regards, Bart. On Thu, Jul 21, 2011 at 3:52 PM, Sam Harwell sharw...@pixelminegames.comwrote: Your example is ambiguous as well as left recursive. I assume you meant one of the following:

[il-antlr-interest: 33281] Re: [antlr-interest] (no subject)

2011-07-21 Thread John B. Brodie
Greetings! On Thu, 2011-07-21 at 14:53 +0200, Roland Sako wrote: Hello, I am Roland Sako from Geneva in Switzerland. I am currently working on a project which I need to generate an expression tree of an Objective-C source code, then I will visit that tree to add extra instruction in it.

[il-antlr-interest: 33282] Re: [antlr-interest] ANTLR gives segmentation fault for very large input

2011-07-21 Thread Piyush
Is there is any way to delete AST (Abstract Syntax Tree) because it is of no use for my work. On Tue, Jul 19, 2011 at 9:08 PM, Jim Idle [via ANTLR] ml-node+6599207-454424018-346...@n2.nabble.com wrote: You are running out of memory - split up the input in some sensible way. Jim -Original

[il-antlr-interest: 33283] [antlr-interest] on crap grammars

2011-07-21 Thread Vlad
This test grammar was called crap by Jim Idle. I am willing to eat the humble pie and admit where I am an ANTLR novice or don't know something about grammars, but I am just not seeing it in this simple case: grammar testerrors; options { language='C'; } NAME: ( 'a'..'z' | 'A'..'Z' |

[il-antlr-interest: 33284] Re: [antlr-interest] ANTLR gives segmentation fault for very large input

2011-07-21 Thread Sam Harwell
To skip the AST, just don't use the output=AST option. Here are some specs on the tokens. I'm including the overhead of having them in a CommonTokenStream (or equivalent) because they're not very useful otherwise. Java target, 32-bit VM: 48 bytes/token. Java target, 64-bit VM: 64 bytes/token.

[il-antlr-interest: 33285] Re: [antlr-interest] Deciphering the TreeWalker error message ...

2011-07-21 Thread Kevin J. Cummings
On 07/21/2011 02:48 AM, Gary Miller wrote: 3. rule : ^(subrule otherrule) ; Just looks wrong. I am under the impression that a treewalker rule should be rooted in a TOKEN, not a subtree. The few treewalker grammars I have written always have rules that look like ^(TOKEN some other rules

[il-antlr-interest: 33286] Re: [antlr-interest] on crap grammars

2011-07-21 Thread Justin Murray
As Jim pointed out, your problem with tokens showing up in error messages as invalid is because you just inlined lexer tokens (in your type rule) without giving them a name. Try making two real lexer rules with the names you would like to see: INT : 'int'; FLOAT : 'float'; type : INT | FLOAT;

[il-antlr-interest: 33287] Re: [antlr-interest] Antlr C target with LibXML

2011-07-21 Thread Jim Idle
Also note that it should be possible (and desirable) for you to separate the logic so you don't need both headers at the same time. Please post your grammar files to get more help. Jim -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest- boun...@antlr.org]

[il-antlr-interest: 33288] Re: [antlr-interest] (no subject)

2011-07-21 Thread Jim Idle
I think that it is a v2 grammar right? JIm -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest- boun...@antlr.org] On Behalf Of John B. Brodie Sent: Thursday, July 21, 2011 7:03 AM To: Roland Sako Cc: antlr-interest@antlr.org Subject: Re:

[il-antlr-interest: 33289] Re: [antlr-interest] ANTLR gives segmentation fault for very large input

2011-07-21 Thread Jim Idle
Are you sure? Well, just don't generate it and remove the instructions that do? Jim -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest- boun...@antlr.org] On Behalf Of Piyush Sent: Thursday, July 21, 2011 8:18 AM To: antlr-interest@antlr.org Subject:

[il-antlr-interest: 33291] Re: [antlr-interest] [C target] Warnings in 64-bit compile

2011-07-21 Thread Jim Idle
Yep - consider it done. Jim -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest- boun...@antlr.org] On Behalf Of Justin Murray Sent: Thursday, July 21, 2011 10:19 AM To: antlr-interest@antlr.org Subject: Re: [antlr-interest] [C target] Warnings in

[il-antlr-interest: 33293] Re: [antlr-interest] [C target] Warnings in 64-bit compile

2011-07-21 Thread Justin Murray
Understood, thanks! On 7/21/2011 1:49 PM, Jim Idle wrote: Well actually as this is a change to the template, it is not in the 3.4 release, but will be in the next patch release (should there be one). Jim -Original Message- From: antlr-interest-boun...@antlr.org

[il-antlr-interest: 33294] Re: [antlr-interest] [C target] Warnings in 64-bit compile

2011-07-21 Thread Julien BLACHE
Jim Idle j...@temporal-wave.com wrote: Hi Jim! Well actually as this is a change to the template, it is not in the 3.4 release, but will be in the next patch release (should there be one). While we're talking C target and release, any ETA for the C runtime tarball for 3.4? Thanks, JB. --

[il-antlr-interest: 33295] Re: [antlr-interest] 'Dude' error in v3.4 and possible bugs explained [was: on crap grammars]

2011-07-21 Thread Vlad
Previously I was on 3.2 runtime. It occurred to me to try 3.4 released a day ago. To this end I've switched to 3.4-beta4 runtime as well. Using one of the testerrors.g grammars with non-inlined int/float tokens and parser generated by antlr-3.4-complete.jar I now get on input string name : bad:

[il-antlr-interest: 33296] Re: [antlr-interest] [C target] Warnings in 64-bit compile

2011-07-21 Thread Jim Idle
Today - I am just reviewing a few things to see if I want to fix them first... Jim -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest- boun...@antlr.org] On Behalf Of Julien BLACHE Sent: Thursday, July 21, 2011 11:28 AM To: antlr-interest@antlr.org

[il-antlr-interest: 33298] Re: [antlr-interest] 'Dude' error in v3.4 and possible bugs explained [was: on crap grammars]

2011-07-21 Thread Justin Murray
I think that Vlad may be onto something here. From what I can tell from my generated grammar, this only affects ANTLR3_MISMATCHED_SET_EXCEPTION type exceptions. My grammar has several hundred parser rules, but only in 4 cases is a ANTLR3_MISMATCHED_SET_EXCEPTION generated. In all 4 cases, the

[il-antlr-interest: 33299] Re: [antlr-interest] 'Dude' error in v3.4 and possible bugs explained [was: on crap grammars]

2011-07-21 Thread Jim Idle
This was changed because the tool no longer generates those sets. Jim -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest- boun...@antlr.org] On Behalf Of Justin Murray Sent: Thursday, July 21, 2011 12:28 PM To: Vlad Cc: antlr-interest@antlr.org

[il-antlr-interest: 33304] Re: [antlr-interest] Incompatible type in subrules with OR

2011-07-21 Thread Gary Miller
Try the following options. 1. locationStep: edge condition? (repeat | shortestPath)? ('' locationStep)? - ^(LOCATIONSTEP condition? repeat? shortestPath? locationStep?); condition: ( filter | subquery ) condition? - ^(CONDITION filter? subquery? condition?); or 2. locationStep : edge