Easily write Bash with a transpiler
15 points by Mte90
15 points by Mte90
slides (with unsettling animations)
yeah I know I wanted to add a bit of swish... I am use that template since years but maybe some things can be removed
TBH having something generate bash is not what I’ve ever wanted.
When I was too lazy to write a script I got an LLM to do it and it was very good.
Mostly I just write it by hand.
Also, irrelevantly, while looking at the slides I thought “Who is this Amber Lang? I thought the authors name was different.”
Today with llm create a script it is very easy, that's true. The project started before the llm era anyway.
One of my idea is to create a finetuned model to generate amber scripts or convert bash/python.
About the amber lang I see your point as author name
Cool! I always feel a little anxious when I need to write a non-trivial bash script; something safer that compiles to bash is a great idea. Does it compile to reasonably readable bash and preserve comments? I can't find an a <-> b comparison in the docs. Probably a hard requirement... I wouldn't want to do distribute something that looks like an obfuscated script.
To answer my own question: I don't know but I suspect it does not compile to something "human readable". The example on amber-lang.com does not work -- trying to build it produces a bash script with just a comment with metadata.
The install script seems to be generated by amber though, and it doesn't look like something a human would write. It also calls sudo behind your back, so beware.
How hard do you think it would be to use amber as a foundation for targeting more shell languages (especially if trimming back the features supported was viable?)
(One use case would be something that could support single-sourcing shell profile/rc hooks for projects that need them.)
This is a nice start but no associative arrays hurts. Anyone know of what's planned or any roadmap of features?
I would say bash barely has associative arrays ... the parsing and evaluation rules are not settled upon
e.g. see this thread about assoc_expand_once: https://lists.gnu.org/archive/html/help-bash/2025-12/msg00000.html
which I linked here: https://lobste.rs/s/lchmal/oils_0_37_0_alpine_linux_ysh_mycpp#c_9ukecl
bash has lots of broken features.
It's not just the syntax -- it's also the evaluation and dynamic parsing implemented by the runtime.
Another example here -- the broken-ness is mentioned in the bash manual itself: https://lobste.rs/s/sew4le/shell_scripts#c_mdhrkb