[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] GSL Shell new beta release with anti-gran graphics module
- From: David Kastrup <dak@...>
- Date: Thu, 03 Dec 2009 18:00:33 +0100
Francesco Abbate <gslshell@gmail.com> writes:
> 2009/12/3 David Kastrup <dak@gnu.org>:
>> If you say the latter, then you need to extend the precedence hierarchy
>> of Lua by another level. There are already 8 levels.
>>
>> Is this syntax extension worth introducing another precedence level?
>
> Actually there is a shift/reduce conflict in the grammar
Which is bisonbabble for "we need another precedence level".
> since the expression
> |x| x or y
> can be parsed as:
> (|x| x) or y
> or
> |x| (x or y)
>
> But please note that for your example, there is no difference between
> |x| x+y
> and
> |x| x or y
> Since both '+' and 'or' are considered operators.
Depends on the precedence of the |...| operator. If it is in between +
and or, there is a difference.
> The answer is that once '|' args '|' is parsed Lua recursive descent
> parser just look for an 'expr' and will eat (shift) everything that
> looks as an expression.
As long as you declare the expr reduce as higher precedence as the |
args | reduce. Or just pray that the order of declaration will
implicitly do this for you.
> So something like
> |x| x or y
>
> will always be parsed as |x| (x or y) and no new precedence level has
> been introduced.
Just because you ignore shift/reduce conflicts and hope for the best, it
does not mean that they are not there.
Whether you explicitly state the precedence or cross fingers and pray
that bison does the right thing behind your back, the new precedence
level is there.
--
David Kastrup