[il-antlr-interest: 29295] [antlr-interest] Noob Question

2010-07-02 Thread Martin Jacobson
I have the following error:

/Users/martin/ANTLR/SVG/PathParser.g:0:0: syntax error: codegen:
AST:0:0: unexpected end of subtree

What does this indicate?
Is there a searchable archive I can trawl through?

Any help gratefully received!
Martin

-- 
From my MacBook Pro

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.



[il-antlr-interest: 29296] Re: [antlr-interest] Noob Question

2010-07-02 Thread Bart Kiers
Hi Martin,

On Fri, Jul 2, 2010 at 2:35 PM, Martin Jacobson
jacobson.mar...@gmail.comwrote:

 I have the following error:

 /Users/martin/ANTLR/SVG/PathParser.g:0:0: syntax error: codegen:
 AST:0:0: unexpected end of subtree

 What does this indicate?


Not sure. If, after search the below link, you're still stuck, could you
post the grammar?



 Is there a searchable archive I can trawl through?


Yes: http://antlr.markmail.org/

Regards,

Bart Kiers.

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.



[il-antlr-interest: 29298] Re: [antlr-interest] unable to run or debug grammar in antlrworks 1.4 on Windows XP

2010-07-02 Thread Mikesell, Darin B.
I've gotten this time-out error in the past also.  It usually occurs when I'm 
using a look-ahead of k=2, if I change the look-ahead to k=1 and then 
recompile, it will sometimes spit out an error that leads me to a fix.  I can 
then fix the error, set look-ahead back to k=2, and then I'm able to debug.


- Darin


-Original Message-
From: antlr-interest-boun...@antlr.org 
[mailto:antlr-interest-boun...@antlr.org] On Behalf Of Matt Palmer
Sent: Friday, July 02, 2010 5:21 AM
To: Jane Eisenstein
Cc: antlr-interest@antlr.org
Subject: Re: [antlr-interest] unable to run or debug grammar in antlrworks 1.4 
on Windows XP

I have exactly the same issues, but running on Ubuntu 10.04, so it's not a
windows issue.  Strangely, some grammars the debugger runs, and others it
simply times out.  I haven't figured out what is going on yet.


On 10 May 2010 21:38, Jane Eisenstein jane.eisenst...@medecision.comwrote:

 I've been using the Snow Leopard version of antlrworks to develop and run a
 simple grammar. At work, I only have Windows XP and am running into problems
 trying to run/debug the grammar with the MS Windows version of antlrworks.
 I'm using sun's jdk1.6.0_17.

 Selecting Run/Run... results in this console message: TODO: run and send
 output to this console
 Is this command not supported under MS Windows?

 Also, trying to debug results in an alert stating:
 Cannot launch the debugger Tab. Time-out waiting to connect to the remote
 parser.
 Running netstat -aon | find /i 49100 returns no results

 Is there something I can do to correct these problems?




 --
 The information transmitted is intended only for the person or entity to
 which it is addressed and may contain confidential and/or privileged
 material. Any review, retransmission, dissemination or other use of, or
 taking of any action in reliance upon, this information by persons or
 entities other than the intended recipient is prohibited. If you received
 this message in error, please contact the sender and delete the material
 from any computer.

 --


 List: http://www.antlr.org/mailman/listinfo/antlr-interest
 Unsubscribe:
 http://www.antlr.org/mailman/options/antlr-interest/your-email-address


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.



[il-antlr-interest: 29299] Re: [antlr-interest] Noob Question

2010-07-02 Thread Mikesell, Darin B.
All your rules are setup as Lexer rules in your grammar. Just remember, in 
ANTLR, Parser rules start with a lower case letter; you just need to change the 
first letter to lowercase in all your Parser rules.


- Darin



-Original Message-
From: antlr-interest-boun...@antlr.org 
[mailto:antlr-interest-boun...@antlr.org] On Behalf Of Martin Jacobson
Sent: Friday, July 02, 2010 6:22 AM
To: antlr-interest@antlr.org
Subject: Re: [antlr-interest] Noob Question

I suspect the error message is too generic to be useful for a noob like me!
I am trying to parse SVG path data and create Geometry objects
(using the JTS library) - I have a working, but limited parser that I
hand-coded, and a Java-CUP/JFlex version that has serious issues
surrounding Classpaths. I have started to look at ANTLR, and produced
the following in ANTLRWorks...

== begin ==
grammar PathParser;

INT :   '0'..'9'+
;

FLOAT
:   ('0'..'9')+ '.' ('0'..'9')* EXPONENT?
|   '.' ('0'..'9')+ EXPONENT?
|   ('0'..'9')+ EXPONENT
;

WS  :   ( ' '
| '\t'
| '\r'
| '\n'
)* {$channel=HIDDEN;}
;

fragment
EXPONENT : ('e'|'E') ('+'|'-')? ('0'..'9')+ ;


CmdM:   'M' FLOAT ','? FLOAT LineArgs?;
Cmdm:   'm' FLOAT ','? FLOAT LineArgs?;

LineArgs
:   (FLOAT ','? FLOAT)+;

CmdL:   'L' LineArgs;
Cmdl:   'l' LineArgs;

CmdZ:   'Z'|'z';

MoveDrawCmd
:   CmdM Cmdm* (CmdL|Cmdl)* CmdZ?;

PathParser
:   MoveDrawCmd+;
end=

I also don't know whether/how to indicated that whitespace is allowed,
but optional between lexer tokens.

Thanks for any insights!
Martin

On 2 July 2010 13:50, Bart Kiers bki...@gmail.com wrote:
 Hi Martin,
 On Fri, Jul 2, 2010 at 2:35 PM, Martin Jacobson jacobson.mar...@gmail.com
 wrote:

 I have the following error:

 /Users/martin/ANTLR/SVG/PathParser.g:0:0: syntax error: codegen:
 AST:0:0: unexpected end of subtree

 What does this indicate?

 Not sure. If, after search the below link, you're still stuck, could you
 post the grammar?


 Is there a searchable archive I can trawl through?

 Yes: http://antlr.markmail.org/
 Regards,
 Bart Kiers.



-- 
From my MacBook Pro

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.



[il-antlr-interest: 29300] Re: [antlr-interest] Noob Question

2010-07-02 Thread Martin Jacobson
There you go! I knew it had to be something really dumb!
Thanks, it now generates code!

M

On 2 July 2010 14:51, Mikesell, Darin B. darin.mikes...@gd-ais.com wrote:
 All your rules are setup as Lexer rules in your grammar. Just remember, in 
 ANTLR, Parser rules start with a lower case letter; you just need to change 
 the first letter to lowercase in all your Parser rules.


 - Darin



 -Original Message-
 From: antlr-interest-boun...@antlr.org 
 [mailto:antlr-interest-boun...@antlr.org] On Behalf Of Martin Jacobson
 Sent: Friday, July 02, 2010 6:22 AM
 To: antlr-interest@antlr.org
 Subject: Re: [antlr-interest] Noob Question

 I suspect the error message is too generic to be useful for a noob like me!
 I am trying to parse SVG path data and create Geometry objects
 (using the JTS library) - I have a working, but limited parser that I
 hand-coded, and a Java-CUP/JFlex version that has serious issues
 surrounding Classpaths. I have started to look at ANTLR, and produced
 the following in ANTLRWorks...

 == begin ==
 grammar PathParser;

 INT :   '0'..'9'+
    ;

 FLOAT
    :   ('0'..'9')+ '.' ('0'..'9')* EXPONENT?
    |   '.' ('0'..'9')+ EXPONENT?
    |   ('0'..'9')+ EXPONENT
    ;

 WS  :   ( ' '
        | '\t'
        | '\r'
        | '\n'
        )* {$channel=HIDDEN;}
    ;

 fragment
 EXPONENT : ('e'|'E') ('+'|'-')? ('0'..'9')+ ;


 CmdM    :       'M' FLOAT ','? FLOAT LineArgs?;
 Cmdm    :       'm' FLOAT ','? FLOAT LineArgs?;

 LineArgs
        :       (FLOAT ','? FLOAT)+;

 CmdL    :       'L' LineArgs;
 Cmdl    :       'l' LineArgs;

 CmdZ    :       'Z'|'z';

 MoveDrawCmd
        :       CmdM Cmdm* (CmdL|Cmdl)* CmdZ?;

 PathParser
        :       MoveDrawCmd+;
 end=

 I also don't know whether/how to indicated that whitespace is allowed,
 but optional between lexer tokens.

 Thanks for any insights!
 Martin

 On 2 July 2010 13:50, Bart Kiers bki...@gmail.com wrote:
 Hi Martin,
 On Fri, Jul 2, 2010 at 2:35 PM, Martin Jacobson jacobson.mar...@gmail.com
 wrote:

 I have the following error:

 /Users/martin/ANTLR/SVG/PathParser.g:0:0: syntax error: codegen:
 AST:0:0: unexpected end of subtree

 What does this indicate?

 Not sure. If, after search the below link, you're still stuck, could you
 post the grammar?


 Is there a searchable archive I can trawl through?

 Yes: http://antlr.markmail.org/
 Regards,
 Bart Kiers.



 --
 From my MacBook Pro

 List: http://www.antlr.org/mailman/listinfo/antlr-interest
 Unsubscribe: 
 http://www.antlr.org/mailman/options/antlr-interest/your-email-address

 List: http://www.antlr.org/mailman/listinfo/antlr-interest
 Unsubscribe: 
 http://www.antlr.org/mailman/options/antlr-interest/your-email-address




-- 
From my MacBook Pro

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.



[il-antlr-interest: 29302] Re: [antlr-interest] Issues with mutually left-recursive rules

2010-07-02 Thread Mikesell, Darin B.
I'm not sure if you're willing to take this leap, but you could always throw 
out the EBNF your using (which seems to have many instances of left recursion 
and could be more work than it's worth in trying to eliminate those left 
recursive calls) and start from scratch by redesigning the EBNF from the ground 
up.

In order to help you redesign a new EBNF, you could ask yourself, What grammar 
does this language most closely resemble?  If it's C, then use the C grammar 
that is available online as a template to implementing the EBNF of your 
language.

I can say from my own experience that using the C grammar as a template has 
helped me in implementing two general languages.

Just my .02


- Darin




-Original Message-
From: Christian (VuuRWerK) Seifert [mailto:vuurwerk.christ...@googlemail.com] 
Sent: Friday, July 02, 2010 9:52 AM
To: Mikesell, Darin B.
Subject: Re: [antlr-interest] Issues with mutually left-recursive rules

Yeah, I already read it (I've quote it also in my first message) and
I've tried it as the author described but without success.
It's very very disappointing for me, because I know how and why the
left-recursion happen but I have no clue to solve it :(

The array_declaration should be possible to declare with different
kind of expression. Thus I tried to remove the array_declaration from
the pre_unary_expression-rule and add it to the expression-rule
instead. Now I just get a left-recursion with expression and
array_declaration. I know it is because the array_declaration are
different kind of expression, which can in turn be yet another
array_declaration, which can be in turn ... you got the point :) But
how the hell I can solve the misery? ... :(

- Christian

2010/7/2 Mikesell, Darin B. darin.mikes...@gd-ais.com:
 Have you read the article at the following link:
 http://www.antlr.org/wiki/display/ANTLR3/Left-Recursion+Removal


 And I can't get the
 meaning that an array_declaration is an pre_unary_expression at the
 moment. I've just work it out depending on that EBNF-grammar ...

 An array_declaration is a pre_unary_expression in your grammar because an 
 array_declaration references an expression which references a 
 pre_unary_expression which references an array_declaration which references 
 an expression which references a pre_unary_expression and on and on and on.

 The EBNF grammar that you are using is probably valid, but because ANTLR is a 
 recursive descent parser it cannot handle left-recursive grammars, it would 
 cause an infinite loop.


 - Darin


 -Original Message-
 From: Christian (VuuRWerK) Seifert [mailto:vuurwerk.christ...@googlemail.com]
 Sent: Friday, July 02, 2010 12:33 AM
 To: Mikesell, Darin B.
 Subject: Re: [antlr-interest] Issues with mutually left-recursive rules

 Erm ... it should not :)

 Actually the instanceof-check should work with a primary_variable
 only. For the sake of completeness the primary_variable-rule:
 == 8 ==
 primary_variable    : '$' identifier ( '[' expression ']' | '-' expression 
 )*;
 == 8 ==

 I've changed the pre_unary_expression according to this conclusion:
 == 8 ==
 pre_unary_expression: '++' primary_variable
                    | '--' primary_variable
                    | unary_expression
                    | primary_variable KW_INSTANCEOF identifier
                    | array_declaration
                    ;
 == 8 ==

 But the error still exists :(

 If I remove the array_declaration-rule from the
 pre_unary_expression-rule the error disappear. And I can't get the
 meaning that an array_declaration is an pre_unary_expression at the
 moment. I've just work it out depending on that EBNF-grammar ...

 But I hope I found a solution for my plight.


 2010/7/2 Mikesell, Darin B. darin.mikes...@gd-ais.com

 So in your grammar it's possible to have an expression of the form:

 ++primary_variable KW_INSTANCEOF identifier KW_INSTANCEOF identifier 
 KW_INTANCEOF identifier KW_INSTANCEOF identifier and on and on?


 - Darin

 -Original Message-
 From: Mikesell, Darin B.
 Sent: Thursday, July 01, 2010 3:51 PM
 To: 'vuurwerk.christ...@gmail.com'
 Subject: RE: [antlr-interest] Issues with mutually left-recursive rules

 So in your grammar it's possible to have an expression of the form:

 ++primary_variable KW_INSTANCEOF identifier KW_INSTANCEOF identifier 
 KW_INTANCEOF identifier KW_INSTANCEOF identifier and on and on?


 - Darin


 -Original Message-
 From: antlr-interest-boun...@antlr.org 
 [mailto:antlr-interest-boun...@antlr.org] On Behalf Of Christian (VuuRWerK) 
 Seifert
 Sent: Thursday, July 01, 2010 3:03 PM
 To: antlr-interest@antlr.org
 Subject: [antlr-interest] Issues with mutually left-recursive rules

 Hi list,

 I've got some troubles with mutually left-recursive rules in my
 grammar (which is just an easy conversion of an original EBNF
 grammar).

 First the error message:
 == 8 ==
 error(210):  The 

[il-antlr-interest: 29303] Re: [antlr-interest] Basic predicate question

2010-07-02 Thread Zeafla, Larry
It is true that Antlr is gross overkill for this example.  This example
is just a simplified version of the grammar of a subset of the overall
problem.  The example was selected as a starting point as it appeared to
be a relatively simple grammar to use for learning Antlr.  The overall
problem is much more complex and hopefully a more appropriate use of
Antlr.

  Larry
 

-Original Message-
From: John B. Brodie [mailto:j...@acm.org] 
Sent: Thursday, July 01, 2010 4:23 PM
To: Zeafla, Larry
Cc: antlr-interest@antlr.org
Subject: Re: [antlr-interest] Basic predicate question

Greetings!
On Thu, 2010-07-01 at 14:03 -0400, Zeafla, Larry wrote:
 I am new to Antlr, which I am trying to use to parse simple existing
 messages.  The message structure is exceptionally simple and
 straightforward.  Message fields include integer and floating-point
 numbers, single letter codes, and field separator characters.  Each
 individual message type has a narrowly defined structure, needs no
look
 ahead, and typically has at most 2 possible tokens for any location in
 the message.
 
Welcome!

Respectfully, in my opinion, using ANTLR for this task seems to be
overkill. Why not just read each message into a String. Use the split()
method on the comma in order to get the fields. And then analyze the
array returned by split(,)? (or maybe regular expressions?)
 

 My problem is that one of the fields is a 2-digit (in ASCII)
 representation of a hex number.  This is known purely from context.
It
 seems there should be a simple technique (probably a predicate), to
 force this behavior.  I just can't seem to find it.
 
  
 
 Here is a short sample grammar to illustrate:
 
   grammar sample;
   prog   :   test+ ;
   test:   'TEST' COMMA INT COMMA FLOAT ( 'A' | 'B' ) 
 
   COMMA HEX_DIGIT  HEX_DIGIT;
 
   HEX_DIGIT   :  '0'..'9' | 'A'..'F' | 'a'..'f'  ;
   INT :  '0'..'9'+ ;
   FLOAT   :  '0'..'9'+ ('.' '0'..'9'*)? ; 
   COMMA   :  ',' ;
 
 The associated test input is:
 
   TEST,123,5.6A,2D
 
   TEST,321,4.20A,3B
 
   TEST,45,5.68B,78
 
 
 
 For this example, the hex digits are the last 2 characters on each
line.
 For the first test statement, parsing is successful.  For the second,
I
 get a MismatchedTokenException (0!=0) on the B (the last character).
 For the third, I get a MismatchedTokenException(0!=0)  on the 7 (the
 next to last character).  I am definitely confused.

as pointed out in another message in this thread. you have specified
that 'A' and 'B' are keywords in your language and yet you also want
them to be HEX_DIGITs. the lexer can not work out this ambiguity (i
believe). same problem with '0' .. '9'  are they a HEX_DIGIT or are
they a single digit INT?

if you really really want to do this task using ANTLR (see above rant
regarding split() and regex's) I think you will have to do all of the
work in the parser.

usually manipulating individual characters in parser rules quickly leads
to parsing ambiguities. but your problem as stated seems to be simple
enough that it will not be a problem (unless you are gonna add more
stuff).

attached please find an alternative grammar of your sample that
illustrates this approach tested with just your 3 sample inputs.

Hope this helps...
   -jbb


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.



[il-antlr-interest: 29304] [antlr-interest] Working on ObjC templates

2010-07-02 Thread Alan Condit
I am trying to add name and type to ObjC.stg as attributes of return type. But 
I keep getting an error saying that java.util.ArrayList has no such attribute: 
type in template context[headerFile if(PARSER)_subtemplate 
parserHeaderFile(...) anonymous anonymous
returnScopeInterface if(!ruleDescriptor.isSynPred)_subtemplate
if(ruledescriptor.hasMultipleReturnValues)_subtemplate
if(scope.attributes:{it.type;};_subtemplate

So where is it that I need to add type that I haven't done.

I added it here:
ruleDeclarations() ::= 
ruleDescriptor.returnScope.attributes:{ a |
a.type a.name; }
if(ruleDescriptor.hasMultipleReturnValues)
returnType() _retval = [[returnTypeName() alloc] init];
[_retval setStart:[input LT:1]];\n
else
if(ruleDescriptor.hasSingleReturnValue)
returnType() _ruleDescriptor.singleValueReturnName = 
initValue(typeName=returnType());
endif
endif

Thanks in advance,
Alan
---

Alan Condit
1085 Tierra Ct.
Woodburn, OR 97071

Email -- acon...@ipns.com
Home-Office (503) 982-0906


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.



[il-antlr-interest: 29306] Re: [antlr-interest] Managing more than one node as root exceptions

2010-07-02 Thread Andreas Stefik
Hi again all,

And of course, in classic ME form, after spending 10 hours making this
problem much more difficult than it really is, I figure out the
solution 10 minutes after forever making my misunderstandings public.
So, the solution is trivial:

atom:
qualified_name - ^(QUALIFIED_SOLO_EXPRESSION qualified_name)
|   qualified_name LEFT_SQR_BRACE expression RIGHT_SQR_BRACE -
^(ARRAY_EXPRESSION qualified_name LEFT_SQR_BRACE 
expression RIGHT_SQR_BRACE)
|   qualified_name (COLON ID)? LEFT_PAREN (expression (COMMA
expression)*)? RIGHT_PAREN -
^(FUNCTION_CALL qualified_name (COLON ID)? LEFT_PAREN 
(expression
(COMMA expression)*)? RIGHT_PAREN)
| (MINUS)? INT
| BOOLEAN
| (MINUS)? DECIMAL
| STRING
| NULL
| LIBRARY_CALL LEFT_PAREN expression COMMA expression COMMA
expression RIGHT_PAREN
| INPUT LEFT_PAREN expression RIGHT_PAREN
| LEFT_PAREN expression RIGHT_PAREN - ^(expression)
;

I guess I wrote the rule the other way thinking I would avoid left
recursion (a typically sensible practice for LL), but when you write
it that way, you can't write rewrite rules (or I couldn't figure out
how), where there are two alternatives ^( this | that), with imaginary
roots. I'm still not sure I completely grasp why the alternative threw
multiple root exceptions, though. My best guess is that
qualified_name rule can have multiple tokens (roots), so it doesn't
necessarily qualify as a single root. However, why that would work
fine normally, but not when nested inside the LEFT_PAREN expression
RIGHT_PAREN rule still isn't obvious to me.

Anyway, sorry to bother everyone, and thanks for the potential help,

Stefik

On Fri, Jul 2, 2010 at 8:37 PM, Andreas Stefik stef...@gmail.com wrote:
 Hi folks,

 I have a relatively simple grammar, which works well under most
 conditions, but in one case it has issues. Here is a snippet of the
 grammar:

 expression :    or      ;
 or      :       and (OR ^ and)*         ;
 and     :       equality (AND ^ equality)*      ;
 equality:       comparison ((EQUALITY ^ | NOTEQUALS ^) comparison)*     ;
 comparison:     add ((GREATER ^| GREATER_EQUAL ^| LESS ^| LESS_EQUAL^) add)*  
   ;
 add     :       multiply ((PLUS ^| MINUS^) multiply)*   ;
 multiply:       combo_expression ((MULTIPLY ^| DIVIDE ^|MODULO^) 
 combo_expression)*     ;
 combo_expression
        :       atom
        |       NOT atom
        |       CAST LEFT_PAREN assignment_declaration COMMA expression 
 RIGHT_PAREN
        ;
 atom    : qualified_name
        (
                LEFT_SQR_BRACE expression RIGHT_SQR_BRACE //this condition 
 breaks
        |       (COLON ID)? LEFT_PAREN (expression (COMMA expression)*)?
 RIGHT_PAREN //so does this one
        )?
        | (MINUS)? INT
        | BOOLEAN
        | (MINUS)? DECIMAL
        | STRING
        | NULL
        | LIBRARY_CALL LEFT_PAREN expression COMMA expression COMMA
 expression RIGHT_PAREN
        | INPUT LEFT_PAREN expression RIGHT_PAREN
        | LEFT_PAREN expression RIGHT_PAREN - ^(expression) ;

 So far as I can tell from testing, this works fine, except in the case
 where you have an expression with surrounding parentheses and the item
 inside of it is a qualified_name, with either square braces or the
 part of the rule after it. In this particular case, the following
 exception is thrown:

 java.lang.RuntimeException: more than one node as root (TODO: make
 exception hierarchy)
        at 
 org.antlr.runtime.tree.BaseTreeAdaptor.becomeRoot(BaseTreeAdaptor.java:150)
        at org.sonify.vm.hop.parser.HopParser.atom(HopParser.java:4954)
 //notice it is in the parser, not the tree grammar
        at 
 org.sonify.vm.hop.parser.HopParser.combo_expression(HopParser.java:4403)

 To give an example of what would break in the language (not all rules
 shown), this would work fine:

 boolean array a
 a[0] = 10
 a[1] = a[0]

 and this would throw the above exception

 boolean array a
 a[0] = 10
 a[1] = (a[0])

 I've tried everything obvious (to me) that I can think of (e.g.,
 pulling out the rules one by one), but am perplexed as to why that
 rule throws a double root exception.
 I'm pretty sure the problem is relative to this portion of the
 grammar, but just in case, here is the full grammar:

 https://sourceforge.net/apps/trac/sodbeans/browser/trunk/sodbeans/Compiler/src/org/sonify/vm/hop/parser/Hop.g
 and the full tree grammar:
 https://sourceforge.net/apps/trac/sodbeans/browser/trunk/sodbeans/Compiler/src/org/sonify/vm/hop/parser/HopSymbolTableWalker.g

 When I run the code in the ANTLRWorks interpreter, it generates the
 trees just fine. One final clue is that my tree grammar is showing UP
 and DOWN tokens, which I know means there is a mismatch somewhere ---
 where, however, and how to fix, I'm not quite sure about, and this
 error seems to be coming from the parser anyway, so I don't suspect
 that that is the cause for