Skip to content

Comment on Regex literals optimization (or how to cheat on benchmarks)parent

Comments

I call the technique "lexer modes" but it's trivial:

When Are Lexer Modes Useful? 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

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=parsing-shell#par...

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.