help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: %prec doesn't seem to work?


From: Akim Demaille
Subject: Re: %prec doesn't seem to work?
Date: Thu, 4 Apr 2013 14:48:23 +0200

Le 3 avr. 2013 à 20:28, Hans Aberg <address@hidden> a écrit :

> On 3 Apr 2013, at 04:52, Adam Smalin <address@hidden> wrote:
> 
>> ... I have no idea how i can fix this without rewriting it all.
> 
> 
> Have you tried getting the lexer to emit two '>' when it sees a ">>", say by 
> using an parenthesis-matching integer count?

Hi Hans,

I'm not sure what you mean here, if you don't teach the scanner ">>" but ">",
on ">>" it will return '>' and '>'.  I don't see what you mean with
the counter.

However, there might be means to do what Adam wants by cheating in
a comparable way: in the scanner recognize ">" followed by ">",
and make it a different token (have a look at / in Flex's documentation).

This way you would have

exp:  exp ">" exp
   |  exp ">2" ">" exp  %prec ">2"

and then you can express your precedence on ">2" vs ">".

And where ">" and ">2" are both ok, use

rbracket: ">" | ">2";




reply via email to

[Prev in Thread] Current Thread [Next in Thread]