3 ms·
Wouldn't most projects use a parser generator anyway? Making the choice of language separate from "what's the best language for parsing stuff".
by FartyMcFarter 4y ago
Wouldn't most projects use a parser generator anyway? Making the choice of language separate from "what's the best language for parsing stuff".
- anthk 4y agoTCL?
- chubot 4y agoParser generators aren't widely used for implementing shells (or JavaScript engines, or C/C++ compilers, for that matter). IMO they're nice for designing languages, but not necessarily implementing them. bash is actually one of the only shells that uses yacc, and the maintainer regards it as a mistake. It uses yacc for maybe 1/4 of the language and the rest is all hand written stuff intertwined with generated code. It's pretty messy. See http://www.aosabook.org/en/bash.html http://www.aosabook.org/en/bash.html and e.g. https://www.oilshell.org/blog/2016/10/13.html https://www.oilshell.org/blog/2016/10/13.html
- ilyash 4y agoI might have issues later. For now, in Next Generation Shell peg/leg parser is doing fine (with limited scripting around to avoid repetition). https://piumarta.com/software/peg/ https://piumarta.com/software/peg/ https://github.com/ngs-lang/ngs/blob/bdfb2fd70162cd7183ac8d45c774a5718cb19b09/syntax.leg https://github.com/ngs-lang/ngs/blob/bdfb2fd70162cd7183ac8d4...