3 ms·
This is a hand-written parser for the shell itself (portable shell parsing portable shell): https://gist.github.com/alganet/23df53c567b8a0bf959ecbc7b68997c0 ht
by gaigalas 7mo ago
This is a hand-written parser for the shell itself (portable shell parsing portable shell):
https://gist.github.com/alganet/23df53c567b8a0bf959ecbc7b68997c0 https://gist.github.com/alganet/23df53c567b8a0bf959ecbc7b689...
It's an incomplete idea from around a year ago. The approach taken here (aliases as macro-like evals, AST generation using shell variables) became the backbone for the BNF parser generator.
This one is much simpler to understand. Simpler grammars tend to produce parser code that looks more like this one.