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
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+)
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
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
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
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
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.
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
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:
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.
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
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' |
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.
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
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;
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]
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:
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:
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
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
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.
--
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:
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
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
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
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
26 matches
Mail list logo