kjosib / booze-tools

Booze Tools will become the complete programming-language development workbench, all written in Python 3.9 (for now).
MIT License
14 stars 1 forks source link

Canonical LR(1) Support #15

Closed kjosib closed 5 years ago

kjosib commented 5 years ago

With today's systems it's at least feasible to build canonical LR(1) tables using the classical algorithm. It's instructive to at least have an implementation, even if it's not intended for common use. A nice cherry-on-top would be a command-line argument to the compiler telling which table-generation method to apply.

kjosib commented 5 years ago

The algorithm is written, tested, and seems to work. Soon it will be plugged into the compiler command-line and subjected to additional stress-tests.

kjosib commented 5 years ago

The full battery of tests and examples have been run. It's true what they say about Canonical-LR(1): Tables for practical grammars are 3-5x larger and that makes my CPU fan spin up during the build process. Profiling shows compaction:decompose_by_edit_distance might be a great candidate for some algorithmic improvements: the Pascal example-grammar made it take upwards of 20 seconds in CLR mode on my machine. It seems to spend most of its time calling sum(...). But anyway, this issue is closed.