Skip to content
This repository was archived by the owner on Dec 21, 2025. It is now read-only.
This repository was archived by the owner on Dec 21, 2025. It is now read-only.

LALR error: Unknown conflict #313

@Alberth289346

Description

@Alberth289346

Installed version:

$ apt list python3-ply
Listing... Done
python3-ply/noble,noble,now 3.11-6 all [installed]

I was starting to write a new parser, and tried to run the file in order to see what was still wrong.

It gave me

Traceback (most recent call last):
  File "/.../parser.py", line 247, in <module>
    p = GenBehaviourParser()
        ^^^^^^^^^^^^^^^^^^^^
  File "/.../parser.py", line 110, in __init__
    self.parser = yacc.yacc(debug=self.debug, module=self, write_tables=1)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/ply/yacc.py", line 3438, in yacc
    lr = LRGeneratedTable(grammar, method, debuglog)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/ply/yacc.py", line 2135, in __init__
    self.lr_parse_table()
  File "/usr/lib/python3/dist-packages/ply/yacc.py", line 2628, in lr_parse_table
    raise LALRError('Unknown conflict in state %d' % st)
ply.yacc.LALRError: Unknown conflict in state 1

Which is not an error I know from the theory :)

I quickly coded a bison specification of (I think) the same grammar, and it gave me

p.y: warning: 7 shift/reduce conflicts [-Wconflicts-sr]
p.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples

The files are quite long, not sure if here is a good place for them. I opted to store them in a gist at https://gist.github.com/Alberth289346/3dddb6602d265b2f88acfb9f9a5bbfee

EDIT:
I forgot to include the input spec, although the parser never gets there:

@doctor_meander

    xy = findIdleTile(random(24)) -- Tile may not exist
    walkAnim(xy)
    idleAnim(random(10, 40))
    if yesno(0.75) then goto doctor_meander end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions