evhub / coconut

Simple, elegant, Pythonic functional programming.
http://coconut-lang.org
Apache License 2.0
4.05k stars 120 forks source link

Incremental parsing support #766

Closed evhub closed 1 year ago

evhub commented 1 year ago

Now that cPyparsing supports incremental parsing, Coconut can make use of that to improve compilation times when compiling a string that is a continuation of a previously-compiled string.

Currently, only the Jupyter kernel/extension and xonsh plugin are making use of this feature, but we could potentially try to find a way to include it in normal compilation too.

evhub commented 1 year ago

cPyparsing now supports improved parsing times even when the two strings share only a common prefix, rather than one being a full prefix of another. Edit: And this works for common suffixes now too.

Additionally, this is now enabled at the interpreter and when using --watch too.

evhub commented 1 year ago

Enabling this to work over the course of multiple invocations of the compiler via writing the cache to a file is now moved to https://github.com/evhub/coconut/issues/772.