bloudraak / lemon-parser-generator

Automatically exported from code.google.com/p/lemon-parser-generator
GNU General Public License v2.0
0 stars 0 forks source link

bug in precedence support #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. untar the attached .tar.gz
2. run ./compile-and-run

What is the expected output? What do you see instead?
'compile-and-run' should just print "4" and exit.

What version of the product are you using? On what operating system?
Lemon version 1.0.  Debian testing.

Please provide any additional information below.

The crux of the problem is that the precedence overrides are ignored, e.g. in

value(v) ::= VALUE(a) COLON VALUE(b) QUESTION VALUE(c). [TERNARY]

the [TERNARY] annotation does nothing, and the rule has the precedence of
COLON.

Original issue reported on code.google.com by lahike...@gmail.com on 2 Jun 2009 at 11:03

GoogleCodeExporter commented 9 years ago

Original comment by lahike...@gmail.com on 4 Jun 2009 at 11:38

Attachments:

GoogleCodeExporter commented 9 years ago
If anyone cares, the bug is in these lines (find_shift_action function):

        if (stateno > YY_SHIFT_MAX ||
            (i = yy_shift_ofst [stateno]) == YY_SHIFT_USE_DFLT) {
            return yy_default [stateno];
        }

It should be 'stateno > YY_SHIFT_COUNT' instead of a 'stateno > YY_SHIFT_MAX'.

Original comment by no.smile...@gmail.com on 10 Oct 2010 at 7:53