Hacker News new | past | comments | ask | show | jobs | submit login
Morbig – A Static Parser for Posix Shell (github.com/colis-anr)
49 points by rasmusfabbe on March 29, 2022 | hide | past | favorite | 7 comments




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)



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")


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.


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...


+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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: