2 ms·
I call the technique "lexer modes" but it's trivial: When Are Lexer Modes Useful? http://www.oilshell.org/blog/2017/12/17.html http://www.oilshell.org/blog/201
by chubot 6y ago
I call the technique "lexer modes" but it's trivial:
When Are Lexer Modes Useful? http://www.oilshell.org/blog/2017/12/17.html http://www.oilshell.org/blog/2017/12/17.html
Overview of the parser:
How to Parse Shell Like a Programming Language http://www.oilshell.org/blog/2019/02/07.html http://www.oilshell.org/blog/2019/02/07.html
You could look at the architecture like this:
reader -> matcher (generated regular languages) -> lexer -> multiple parsers
The lexer takes the mode parameter and has extra logic for disambiguation. There are multiple parsers for multiple dialects, and they're both hand-written and generated.
Feel free to follow up if this catches your interest. I'm looking for feedback on both Eggex and Oil!
more posts:
http://www.oilshell.org/blog/tags.html?tag=eggex#eggex http://www.oilshell.org/blog/tags.html?tag=eggex#eggex
http://www.oilshell.org/blog/tags.html?tag=parsing-shell#parsing-shell http://www.oilshell.org/blog/tags.html?tag=parsing-shell#par...