4 ms·
Some years ago I used the Python library Lark (https://github.com/lark-parser/lark https://github.com/lark-parser/lark) to parse my programming language. It let
by ForceBru 1y ago
Some years ago I used the Python library Lark (https://github.com/lark-parser/lark https://github.com/lark-parser/lark) to parse my programming language. It lets you write your grammar in basically EBNF, builds parse trees (that you can automatically reduce by removing leaves for parentheses, for example) and generates standalone pure-Python LALR(1) parsers for your grammar. Back then, I had a blast with it, it was fast, super easy to use and just worked. Now it's got 5k stars and seems to be a mature and production-ready library.
Thus, I vote Python: it has this amazing parser library, it's garbage-collected (no need to fiddle with memory allocations, like in C), it's dynamically typed (so you basically don't need to think about types at all), it now has a `match` statement (!) that makes it super easy to dissect your parse trees and abstract syntax trees.
- Forgret 1y agoHmm, sounds appealing, and I agree, C is still pretty complicated and the slow speed of the program is not that critical, in exchange for this wonderful library that will save me a lot of time, unlike C.