Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add error when a terminal symbol is passed to
%nterm
In bison when a terminal symbol is passed to `%nterm` it should give an error. But it doesn't yet. It just ignores the terminal symbol and uses the nonterminal symbol. For example in the following code, `EOI` is a terminal symbol and `EOI` is a nonterminal symbol. When `EOI` is passed to `%nterm` it should give an error but it doesn't. ```yacc %{ // Prologue %} %token EOI 0 "EOI" %nterm EOI %% program: /* empty */ ; ``` In bison, it gives the following error ``` ❯ bison test.y test.y:6.8-10: error: symbol EOI redeclared as a nonterminal 6 | %nterm EOI | ^~~ test.y:5.8-10: note: previous definition 5 | %token EOI 0 "EOI" | ^~~ ``` So this PR adds an error when a terminal symbol is passed to `%nterm`.
- Loading branch information