Closed modulovalue closed 9 months ago
you can try to set -soft_keywords .
Interesting:
./lpg2 -soft_keywords output.g
... 80~ conflicts in la=1 mode ...
./lpg2 output.g
... 30~ conflicts in la=1 mode ...
bison output.y
... 460 conflicts in lalr mode ...
@kuafuwang are there perhaps any other flags that you think could help here?
I can not find any other flags . lpg will attempts to resolve conflicts by doing more look-ahead. If the conflict resolution is s successful, then a new state is created and returned
I think It's not lalr 1 when there are conflict. it resolve conflicts by doing more look-ahead.
Weird:
with LPG:
Number of Shift-Reduce conflicts: 62
Number of Reduce-Reduce conflicts: 25
> ./lpg2 -soft_keywords output.g
Number of Shift-Reduce conflicts: 62
Number of Reduce-Reduce conflicts: 25
> ./lpg2 la=1 output.g
Number of Shift-Reduce conflicts: 28
Number of Reduce-Reduce conflicts: 5
>./lpg2 la=12 output.g
with bison:
output.y: warning: 288 shift/reduce conflicts [-Wconflicts-sr]
output.y: warning: 181 reduce/reduce conflicts [-Wconflicts-rr]
...
> bison output.y
I can not find any other flags
Thank you for your help @kuafuwang
Hello @kuafuwang,
I have a quick question and I hope you don't mind if I ask here.
I've noticed that LPG2 reports fewer conflicts with LA=1 than, for example, bison set to LALR(1).
I'm wondering, do you know if there are other techniques that LPG2 uses to remove conflicts (by default), and is there maybe a way to turn them all off?
I'm trying to get LPG2 to report the same amount of conflicts that bison does for LALR(1), but that's never the case. Do you know what could be going on?
Here's, for example, what bison reports for a grammar:
And here's what LPG2 reports:
Notice how LPG2 reports fewer than 100 conflicts, but bison reports almost 500 conflicts.