[antlr-interest] Grammar Problem
Henrique
hjrnunes at student.dei.uc.pt
Thu Aug 7 18:02:39 PDT 2008
Hi guys!
Thanks for your help. I'm gonna dump the tokens then and see if anything's
wrong...
Jim, you can see the grammar
here<http://hjrnunes.googlepages.com/antlrgrammar>and I'm attaching
it.
Henrique Nunes
>
>
>>
>> On Thu, Aug 7, 2008 at 10:52 PM, Jim Idle <jimi at temporal-wave.com> wrote:
>>
>>> On Thu, 2008-08-07 at 19:20 +0100, Henrique wrote:
>>>
>>> Thanks for your replies guys!
>>> Jim, I tried your suggestion but I get the same error...
>>> Johannes, I believe I followed the approach suggested but the thing is I
>>> need buncha_replacements optional...
>>> Furthermore, when I try to parse this:
>>>
>>>
>>> Would probably need to see your whole grammar and sample input then to be
>>> honest.
>>>
>>> Jim
>>>
>>>
>>> rule Foo {
>>> CIRCLE {}
>>> }
>>>
>>> I works good. So I'm guessing it's got something to do with me not making
>>> buncha_adjustments optional the right way:
>>>
>>> rule : RULE USER_STRING (USER_RATIONAL)? LEFTBRACKET
>>> buncha_replacements? RIGHTBRACKET;
>>>
>>>
>>>
>>>
>>> buncha_replacements
>>> : (replacement)+
>>> ;
>>>
>>> replacement
>>> : USER_STRING modification
>>> | USER_STRING STAR modification USER_STRING modification
>>> ;
>>>
>>>
>>> modification
>>> : LEFTBRACKET buncha_adjustments? RIGHTBRACKET
>>> | LEFTBRACE buncha_adjustments? RIGHTBRACE
>>> ;
>>>
>>> buncha_adjustments
>>> : (adjustment)+
>>> ;
>>>
>>> Any more suggestions?
>>> Thanks!
>>>
>>> Henrique Nunes
>>>
>>>
>>> On Thu, Aug 7, 2008 at 6:53 PM, Jim Idle <jimi at temporal-wave.com>
>>> wrote:
>>>
>>> On Thu, 2008-08-07 at 18:40 +0100, Henrique wrote:
>>>
>>> Hi guys!
>>> I'm having some trouble with my grammar for parsing CFA files... As I
>>> posted before, I'm trying to convert their Yacc grammar to ANTLR and now I'm
>>> having some trouble. I suspect it's the left recursions or rather the way I
>>> got ridden of them.
>>> The grammar is attached and can also be seen here<http://hjrnunes.googlepages.com/antlrgrammar>
>>> .
>>>
>>> here's the rules I'm having trouble with:
>>>
>>> rule : RULE USER_STRING LEFTBRACKET buncha_replacements?
>>> RIGHTBRACKET
>>> | RULE USER_STRING USER_RATIONAL LEFTBRACKET buncha_replacements?
>>> RIGHTBRACKET
>>> ;
>>>
>>>
>>>
>>> Try
>>>
>>> rule: RULE USER_STRING (USER_RATIONAL {set flag to say this is here or
>>> something} )? LEFTBRACKET buncha_replacements? RIGHTBRACKET;
>>>
>>> Jim
>>>
>>>
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080808/bfd8a491/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cfdg.g
Type: application/octet-stream
Size: 3374 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20080808/bfd8a491/attachment-0001.obj
More information about the antlr-interest
mailing list