That has probably a lot of overlap with Frink https://futureboy.us/frinkdocs/, though after a quick try the output could be nicer, e.g. like described in this document.
Thanks for pointing this one. I don't think java is the right tool for what I have in mind (because of the JVM overhead) but I'll definitely try Frink.
We could reimplement it in js to freely mix and match with other js based languages.
That was my first thought as well; Frink, if it doesn't have this stuff, probably could.