Wow that alone is perhaps even more impressive than what the program actually does... I thought I knew bash but just wow. Compatible with 5 different shells, too. This is some next level enlightened zen master stuff.
Though not crazy cross compatible, you might find Mal's bash implementation interesting [0]. Mal is a small, easy to implement Lisp.
Don't get too carried away, it's written for ksh and relies on bash and zsh to be compatible with ksh. You can see in the beginning it does a tiny bit of setup and never cares again which shell it runs on. For zsh, it literally says "emulate ksh" which is something zsh provides.
Proving once again that ksh is all you really need in a shell. ;)