Show HN: Zrc, I tried making a Unix shell scripting language with Tcl syntax
github.comSo when I found out about Tcl, a language where everything is a string, including "code blocks". My first thought was "why doesn't this have pipes and execv* as first-class features like an actual shell?". And so Zrc was born.
Granted, the code is not production ready. But it's a sturdy little shell capable of some cool stuff, given that I implemented minesweeper and game of life in it, and I took the risk of daily driving it just because why not?
I've never written an interpreter before so the parsing technique may come off as ad-hoc to some, but it's certainly better than csh.
If I could have changed one thing about the design, maybe it would've been not adding expr at all. I'd have made control flow commands just call their first braced arg as a script (not as an arithmetic expression), and 0 would have been the truthy value and nonzero would be a non-truthy value (like in any other shell). I'd also have added rc's ~ command instead of regexp. And maybe I'd have replaced the <{...} and `{...} substitutions with special commands called ` and `<, to be used with [...] substitution.