BNFC / bnfc

BNF Converter
http://bnfc.digitalgrammars.com/
586 stars 165 forks source link

Haskell backend prints a list `[Char]` containing characters as string #359

Closed andreasabel closed 3 years ago

andreasabel commented 3 years ago

Grammar

(:[]). [Char] ::= "*" Char ";";
(:).   [Char] ::= "*" Char ";" [Char];

and input

* 'A';
* 'B';
* 'C';

results in printed output

"ABC"

The other backends print this correctly.

andreasabel commented 3 years ago

The overloaded prt function can naturally not deal with both of [Char] and String, since these are the same type. Should not be a problem with Text tokens, though.

A way to fix this would be to have a non-overloaded printing function for String, so it does not clash with [Char].

andreasabel commented 3 years ago