BNFC / bnfc

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

Layout processor should use token IDs, not their String rendering #352

Closed andreasabel closed 3 years ago

andreasabel commented 3 years ago

The current layout preprocessor renders tokens as String to check whether they match layout keywords or { } ;. However, each keyword/symbol token comes with an ID that could be checked faster.

Steps to rewrite layout processor (generator) to use IDs instead of String:

andreasabel commented 3 years ago

I chose a different implementation path: Simply use TokSymbol (with the token ID) instead of String in the generated Layout.hs. We need not define constants for each token ID in the lexer. Could be still nice, but this is another issue.