Closed mingodad closed 5 months ago
Also parsertl
doesn't check for duplicated token declaration and this https://github.com/mingodad/parsertl-playground/commit/c9958a7e1b3f401402f795425b36d8a0632c6200 seems to somehow fix it.
It seems bison allows tokens to be re-defined.
%token A
%token A
%left A
%left A
%%
the_a : A ;
%%
Output bison 3.8.2:
bison-nb test-dup-token.y
test-dup-token.y:2.8: warning: symbol A redeclared [-Wother]
2 | %token A
| ^
test-dup-token.y:1.8: note: previous declaration
1 | %token A
| ^
test-dup-token.y:5.1-5: error: %left redeclaration for A
5 | %left A
| ^~~~~
test-dup-token.y:4.1-5: note: previous declaration
4 | %left A
| ^~~~~
Ah, I didn't know that. Done now.
While converting this grammar https://github.com/diku-dk/futhark/blob/master/src/Language/Futhark/Parser/Parser.y to be uded in https://mingodad.github.io/parsertl-playground/playground/ I found that
parsertl
doesn't check for duplicated precedence declarations (that was present on that grammar).This https://github.com/mingodad/parsertl-playground/commit/c5a94a611eff38caddda6f7fc7da80f3ac862223 seems to fix it.