[antlr-interest] ANTLR 3 using k=0, any info on doing this?
Terence Parr
parrt at cs.usfca.edu
Wed Mar 2 10:37:28 PST 2011
Syntactic predicates can only execute actions that can be undone or that have no side effects. to specify such a special action, use {{...}} :) In general though {...}?=> should be for Boolean that say things like "Allow GCC extensions".
Ter
On Mar 2, 2011, at 10:31 AM, The Researcher wrote:
> Ter
>
> Thanks, they work great, but then I run into what I believe is the "Trouble
> with syntactic predicates that reference semantic predicates that rely on a
> current dynamic attribute scope" which is why I have asked Sam about
> @scopeinit. I can get around it, but it doesn't seem intuitive.
>
> If you are anyone else wants me to keep an eye open for certain things while
> writing this grammar, just ask.
>
> I do have several suggestions in the work, but want to have a working
> grammar for at least the PE Image before any write-up, then move onto the
> .text section which is where it will get really interesting.
>
> Eric
>
> On Wed, Mar 2, 2011 at 1:16 PM, Terence Parr <parrt at cs.usfca.edu> wrote:
>
>> Use {...}?=> for this.It forces the predicates to be tested regardless of
>> whether or not the lookahead predicts an alternative.
>>
>> Ter
>> On Feb 28, 2011, at 6:12 PM, The Researcher wrote:
>>
>>> I tried searching the interest group with k=0 but that wasn't productive,
>>> and Google doesn't do any better.
>>>
>>> Yes I know setting k=0 is not what one normally if ever does with ANTLR,
>> but
>>> I am researching what it will take to get ANTLR to validate a Microsoft
>>> Common Language Infrastructure file. I did write a separate validator by
>>> hand and that works great.
>>>
>>> One of my goals out of this is to have a way to write binary file readers
>>> and validators using ANTLR. Yes I know that I will have to modify ANTLR.g
>> to
>>> do this correctly, but before that, I have to know what the current
>> ANTLR.g
>>> is capable of doing and what needs to be modified or enhanced.
>>>
>>> So far I have only fond the ANTLR 2 Java .class file reader by Andreas
>>> Rueckert and the few mentions of using Bytes in "Definitive ANTLR
>>> Reference". I am getting the other book.
>>>
>>> Using gated semantic predicates is working out great, but ANTLR is
>>> determined to check for multiple alternatives. I was hoping that K=0
>> would
>>> shut that whole process down and using the gated semantic predicates to
>>> dynamically shut off the options would leave ANTLR not trying
>> alternatives.
>>>
>>> Any clues or references are welcome.
>>>
>>> Thanks Eric
>>>
>>> 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
More information about the antlr-interest
mailing list