I am… actually not entirely sure what happens here.
Uh oh…
I am not familiar with the specific requirements of a shell, but is there any reason why its parser shouldn’t be replaced with a safe, generated one?
I took a trip over to ksh expecting to see some yacc action (basis: the dhclient parser is being binned), but apparently not… (1 2)
I don’t know this to be the case, but I would be very unsurprised if bash’s grammar is context-sensitive (or worse). “Evolved” grammars like that of shell tend not to be terribly tractable from a language complexity perspective.
(Recall that Perl’s grammar literally cannot be parsed ahead of time.)
Welp, to generate a parser you’d need a formal grammar, right? Pretty sure you’ll not see that for bash.
But you asked about “a shell,” and, sure, you can do this for some-shell-which-isn’t-bash.
Uh oh…
I am not familiar with the specific requirements of a shell, but is there any reason why its parser shouldn’t be replaced with a safe, generated one?
I took a trip over to ksh expecting to see some yacc action (basis: the dhclient parser is being binned), but apparently not… (1 2)
I don’t know this to be the case, but I would be very unsurprised if bash’s grammar is context-sensitive (or worse). “Evolved” grammars like that of shell tend not to be terribly tractable from a language complexity perspective.
(Recall that Perl’s grammar literally cannot be parsed ahead of time.)
Welp, to generate a parser you’d need a formal grammar, right? Pretty sure you’ll not see that for bash.
But you asked about “a shell,” and, sure, you can do this for some-shell-which-isn’t-bash.