patrickfrey / mewa

Compiler-compiler for writing compiler frontends with Lua
https://github.com/patrickfrey/mewa
MIT License
23 stars 2 forks source link

Many SHIFT/REDUCE conflicts reported by lemon or yacc on the same grammar #7

Closed patrickfrey closed 2 years ago

patrickfrey commented 2 years ago

... to be investigated

byacc-nb -v grammar.g.y byacc-nb: 1366 shift/reduce conflicts. 1366 conflicts 103 terminal symbols 58 non-terminal symbols 161 total symbols 235 rules 484 states Exit code: 0 bison-nb -v grammar.g.y grammar.g.y: warning: 1366 shift/reduce conflicts [-Wconflicts-sr] grammar.g.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples Exit code: 0

lemon-nb -s y.yl Can't open the template file "/snap/bin/lempar.c". 1366 parsing conflicts. Parser statistics: terminal symbols................... 102 non-terminal symbols............... 57 total symbols...................... 159 rules.............................. 232 states............................. 323 conflicts.......................... 1366 conflicts S/R...................... 1366 conflicts R/R...................... 0 action table entries............... 0 lookahead table entries............ 0 total table size (bytes)........... 0

Exit code: 1

patrickfrey commented 2 years ago

I will implement stats printed about how conflicts were resolved to build more trust. This will solve the issue.

patrickfrey commented 2 years ago

The number of SHIFT/REDUCE conflicts is now reported in the debug output of mewa to raise the level of trust. mewa gets the same number

-- Statistics: