Settings

Theme

Morbig – A Static Parser for Posix Shell

github.com

49 points by rasmusfabbe 4 years ago · 7 comments

Reader

pabs3 4 years ago

Some talks related to this from the Debian conference:

https://debconf16.debconf.org/talks/63/ https://debconf18.debconf.org/talks/90-mining-debian-maintai... https://debconf19.debconf.org/talks/105-symbolic-execution-o...

loxias 4 years ago

Heck yeah! Thanks for this!

On a whim, I've been doodling ideas for a POSIX(ish)-shell compiled language. Seeing other people interested in such (probably useless, but fun) ideas encourages me.

Thanks OP! (I kinda wish that, of the 6 dependencies, I had heard of at least 2 of them, but beggars can't be choosers. You do you!! And though I've never done so myself, People I Respect (tm) say that Haskell/ML/OCaml are respectable tools for building parsers anyway)

  • pabs3 4 years ago
    • loxias 4 years ago

      thank you thank you thank you!

      The only thing better than finally accomplishing a side project, is finding someone elses side project which is close enough to yours to scratch the itch.

      shc looks very close to what I was thinking. My original motivating thought was something like "if the switch in debian from bash to dash was done for init performance reasons, why are we still directly interpreting the sh, instead of JIT or precomp?" shc has the parsing elements, but one approaches an edge of the "optimization frontier" if instead you emit bytecode which is mostly syscalls, plus you can have performance savings by having pipes in process.

      seriously, I owe you a few beers.

      (edit: hilariously, I apparently had already starred shc on github, and even noted it in my file "for further research")

      • pabs3 4 years ago

        Debian ended up moving to systemd, I think that had a much larger effect on init performance than compiled shell would have.

        The idea though reminds me of the project to shrink essential, including eventually removing bash from essential.

        https://wiki.debian.org/Proposals/EssentialOnDiet

        Related work is getting rid of package postinst shell scripts by making everything declarative.

unhammer 4 years ago

That's great =D Would be interesting to see a comparison to the parse that shellcheck gives[0][1], is this stricter and/or more abstracted perhaps?

[0] https://github.com/koalaman/shellcheck/blob/master/src/Shell...

[1] https://github.com/koalaman/shellcheck/blob/master/src/Shell...

amir734jj 4 years ago

+1 for the clear and well documented parser. It takes serious dedication to write a hand-written parser and not simply use a parser generator.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection