[antlr-interest] antlr-interest Digest, Vol 48, Issue 17

Su Zhang westlifezs at gmail.com
Wed Nov 19 14:35:19 PST 2008


Hi
 I encoutered a problem while using antlr, it said that " unexpected
end of subtree", does anybody have some idea on know how to solve this kind
of problem?

thank you!



2008/11/19, antlr-interest-request at antlr.org <antlr-interest-request at antlr.org>:
> Send antlr-interest mailing list submissions to
> 	antlr-interest at antlr.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://www.antlr.org/mailman/listinfo/antlr-interest
> or, via email, send a message with subject or body 'help' to
> 	antlr-interest-request at antlr.org
>
> You can reach the person managing the list at
> 	antlr-interest-owner at antlr.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of antlr-interest digest..."
>
>
> Today's Topics:
>
>    1. Re: A bug at C# DLLs? (Rodrigo C. L.)
>    2. Re: Failing on case test: how? (Hendrik Maryns)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 18 Nov 2008 17:05:56 -0300
> From: "Rodrigo C. L." <tapetedepadaria at gmail.com>
> Subject: Re: [antlr-interest] A bug at C# DLLs?
> To: "Johannes Luber" <jaluber at gmx.de>
> Cc: antlr-interest at antlr.org
> Message-ID:
> 	<da9e26b90811181205u5ad41a62ndc9bcbebe3ba794 at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> ok, now it's working. If and when I find the cause of what was going
> on, I'll report.
>
> And definition was really trouble. I changed module to generate
> ^(MODULE ID specification?) and now it's going ok.
>
> thank you all, anyway =]
>
>  -- Rodrigo C. Lopes
>  -- Tamb?m em r.cerqueira.lopes at gmail.com
>
>
>
> 2008/11/18 Johannes Luber <jaluber at gmx.de>:
>> Rodrigo C. L. schrieb:
>>> hello, thanks for the help..
>>>
>>> I did all this throught visual studio with .NET, not Mono. I did
>>> compile the grammar with the jar (3.1.1). I'm going to try with NAnt,
>>> but I'm not confident that it'll work.
>>>
>>> Anyway, didn't it ocurred with anyone?
>>>
>>> My ASTLabelType is CommonTree. Does it help if I change it?
>>>
>>> I'm sorry the urge of the questions. I have kind of a deadline. :(
>>
>> Sorry, I just saw that I didn't write which sources I meant. In that
>> particular case it is the runtime itself which has to be compiled with
>> VS, not the generated sources.
>>
>> Johannes
>>>
>>>  -- Rodrigo C. Lopes
>>>  -- Tamb?m em r.cerqueira.lopes at gmail.com
>>>
>>>
>>>
>>> 2008/11/17 Johannes Luber <jaluber at gmx.de>:
>>>
>>>> I believe the cause lies in a bug in the Mono C# compiler. Can you
>>>> compile the sources yourself via Visual Studio? Under windows the Nant
>>>> script is supposed to be working.
>>>>
>>>> Johannes
>>>>
>>>> Rodrigo C. L. schrieb:
>>>>> Hello!
>>>>>
>>>>> I'm new at ANTLR, and I'm using it to generate code for C# (.NET v3.5).
>>>>>
>>>>> My grammar is:
>>>>>
>>>>> tokens {
>>>>> MODULE;
>>>>> SPECIFICATION;
>>>>> }
>>>>> compilation : specification EOF! ;
>>>>> specification : ( definition )* -> ^( SPECIFICATION definition* ) ;
>>>>> definition : module ';' ;
>>>>> module : 'module' ID '{' specification '}' -> ^(MODULE ID
>>>>> specification) ;
>>>>> ID : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')* ;
>>>>>
>>>>> and I have this simple input for test:
>>>>>
>>>>> module etal { };
>>>>>
>>>>> And I got
>>>>>
>>>>> Antlr.Runtime.Tree.RewriteEmptyStreamException{"token ID"},
>>>>>
>>>>> which is odd, because ID should be 'etal'.
>>>>>
>>>>> I changed the rule module using operators and got
>>>>> NullReferenceException, for the same reason.
>>>>>
>>>>> I am new at this, so I'm not sure how to handle. Is this a bug from
>>>>> the DLLs that I should report or I am doing something wrong? Because I
>>>>> tried the same grammar using ANTLRWorks and changing the language to
>>>>> Java, and it worked like a charm, with no errors.
>>>>>
>>>>> I don't know if this was already discussed, thought I searched for
>>>>> this at the most recent Interest Archives. If it was, sorry.
>>>>>
>>>>> Thank you all very much for any help.
>>>>>
>>>>>  -- Rodrigo C. Lopes
>>>>>  -- Also in r.cerqueira.lopes at gmail.com
>>>>>
>>>>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>>>>> Unsubscribe:
>>>>> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>>>>>
>>>>
>>>
>>
>>
>
>
> ------------------------------
>
> Message: 2
> Date: Wed, 19 Nov 2008 17:05:24 +0100
> From: Hendrik Maryns <qwizv9b02 at sneakemail.com>
> Subject: Re: [antlr-interest] Failing on case test: how?
> To: antlr-interest at antlr.org
> Message-ID: <gg1dg4$2uj$2 at ger.gmane.org>
> Content-Type: text/plain; charset="utf-8"
>
> Sam Harwell sharwell-at-pixelminegames.com |news.gmane.org| schreef:
>> Can you make a rule like:
>>
>> variable returns [Variable result]
>>   : IDENTIFIER { $result = getVariable($IDENTIFIER.text); }
>>   ;
>>
>> Where the check is done in the indicated function? If there are cases
>> where only one or the other is allowed, you can also do that semantic
>> analysis at another point. The advantage here is you can have a more
>> "lenient" parser that's able to provide better error messages once you
>> start working on that.
>
> No I can?t, since the constructors of the other formula subtypes expect
> a specific type of variable, either first- or second order, so the rules
> have to return a variable of the appropriate type.
>
>> The other option with *gated* semantic predicates is (I don't do Java so
>> the code is a best guess on what it might be in Java):
>>
>> firstOrderVariable returns [FirstOrderVariable result]
>> 	: {Character.isLowerCase( input.LA(1).getText().charAt(0) )} =>
>>         IDENTIFIER { $result = getFirstOrderVariable($IDENTIFIER.text); }
>> 	;
>>
>> secondOrderVariable returns [SecondOrderVariable result]
>> 	: {Character.isUpperCase( input.LA(1).getText().charAt(0) )} =>
>>         IDENTIFIER { $result = getSecondOrderVariable($IDENTIFIER.text); }
>> 	;
>
> I think that is the way to go, thanks.
>
> H.
> --
> Hendrik Maryns
> http://tcl.sfs.uni-tuebingen.de/~hendrik/
> ==================
> Ask smart questions, get good answers:
> http://www.catb.org/~esr/faqs/smart-questions.html
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: signature.asc
> Type: application/pgp-signature
> Size: 257 bytes
> Desc: not available
> Url :
> http://www.antlr.org/pipermail/antlr-interest/attachments/20081119/31d4a355/attachment-0002.bin
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: signature.asc
> Type: application/pgp-signature
> Size: 257 bytes
> Desc: OpenPGP digital signature
> Url :
> http://www.antlr.org/pipermail/antlr-interest/attachments/20081119/31d4a355/attachment-0003.bin
>
> ------------------------------
>
> _______________________________________________
> antlr-interest mailing list
> antlr-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/antlr-interest
>
>
> End of antlr-interest Digest, Vol 48, Issue 17
> **********************************************
>


-- 
Su Zhang
PHD Candidate
Computer Information and Science
Kansas State University


More information about the antlr-interest mailing list