[1] https://reindeereffect.github.io/2018/12/08/index.html
[2] https://reindeereffect.github.io/2019/01/16/index.html
[3] https://github.com/reindeereffect/tools-from-blog/tree/maste...
[1] https://reindeereffect.github.io/2018/12/08/index.html
[2] https://reindeereffect.github.io/2019/01/16/index.html
[3] https://github.com/reindeereffect/tools-from-blog/tree/maste...
My first idea was to turn the interpretter in a code generator that would generate C code. It produced a massive file, which took very long to compile and to my surprise, was slower than the interpretter. This might be due many missed cache hits.
Next, I decided to implement some caching, simply remembering at each point of the input which non-terminals were parsed or not. This gave a huge performance improvement.
I also added some mechanism to let it generate a Abstract Syntax Tree. Later, I wrote a C++ version that also included an unparser, based on the input grammar. Instant pretty-printer and 'unifier'.
Recently, I developed a JavaScript version (with a simple caching strategy), which turned out to be still fast enough to follow key strokes for small inputs. (Just parsing the whole input on each key stroke.) See: https://fransfaase.github.io/ParserWorkshop/Online_inter_par...