Related blog articles:
I dug through the library code and figured out how to roll a token-based lexer/parser system from scratch.
Because I usually write S-Expression parsers, I decided to do an M-Expression parser this time.
I learned during this exercise that while Scala’s combinators support back-tracking, they only support LL(*) grammars.
Code
M-Expression lexer/parser: MExpEngine.scala
Related articles
- 26 languages in 25 days: Reflections on language design
- 26 languages in 25 days: Strategy, tactics, logistics
- Understanding and implementing laziness
- Parsing S-Expressions in Scala
- A pipelined, non-blocking, extensible web server in Scala
- Architectures for interpreters
- Lazy-list-based streams in Scala
- Learning Scala in small bites
- An interpreter for Lambdo
- Okasaki red-black tree maps in Scala
- Advanced programming languages
- Desugaring regular operations in context-free grammars
- Grammar: The language of languages (BNF, EBNF, ABNF)
- Parsing regular expressions with recursive descent
- Standalone lexers with lex: synopsis, examples, and pitfalls
- Parsing with derivatives (Yacc is dead: An update)
- A non-blocking lexing toolkit for Scala from regex derivatives
- Lexical analysis and syntax-highlighting in JavaScript
- Matching regular expressions with derivatives
- Implementing regular expressions and NFAs in Java
Twitter: @mattmight
Instagram: @mattmight
LinkedIn: matthewmight
Mastodon: @mattmight@mathstodon.xyz
Sub-reddit: /r/mattmight