Jim Idle wrote:
> Sam Barnett-Cormack wrote:
>> Terence Parr wrote:
>>>
>>> term+=(~(RSQR|LSQR)))*
>>>
>>> is your problem. known bug :) can't add sets to a list yet.
>>>
>>
>> The full rule is:
>>
>> encodingInstruction : (term+=(~(RSQR|LSQR)))* -> ^(ENCINS $term*);
>>
>> I read that as
>>
>> (
>> term+=(
>> ~(RSQR|LSQR)
>> )
>> )*
>>
>> So the term+= is applying to the *single* (~(RSQR|LSQR)), and the whole
>> lot has cardinality zero-to-N. So each iteration adds one thing that is
>> anything-but-rsqr-or-lsqr to term, and this happens zero or more times.
>>
>> Is this not what it says?
>>
>>
>>
> Try something like this:
>
> term+=someTerm* ....
>
>
> someTerm
> : ~(RSQR|LSQR)
> ;
Ah, excellent, thanks. After resolving yet-another inherent ambiguity in
the language ('tag' is a subset of 'encodingPrefix'), it now builds
fine. I think I now have all of the inherent ambiguities sorted, and no
disastrous shortcuts (like arbitrary backtracking) - until I try to add
in support for "information objects" and parametrized types...
This has been a great learning experience, and thanks to all who've
helped with my getting to grips with practical language implementation
stuff. I'm sure I'll need more help when it comes to acting on the AST...
One question though - how come such effectively equivalent constructs
produce such different results?
Sam
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---