SmaCCRefactoring / SmaCC

Smalltalk Compiler Compiler : a parser generator
Other
33 stars 15 forks source link

Parser tables should be on the class side #44

Open apblack opened 6 years ago

apblack commented 6 years ago

Information such as the #symbolNames and the #symbolTypes of a parser is not instance-specific. So would it not be more reasonable to put it in a class-side method?

The use case that would benefit from this is when one is patching up, for example, the tokenActions table at scanner initialization time. It seems unnecessary to create a parser instance just so that one can look up a code corresponding to a symbol in aParser symbolNames.

#transitionTable is also not-instance specific, but there may be a reason to keep this on the instance side.