HACKER Q&A
📣 crabmusket

Embeddable Value-Oriented Languages?


These days, applications need customisation. And instead of having software developers write custom features tied to specific tenants, it can be advantageous to provide ways to configure the software using data.

There are a bunch of examples of these. Excel is obviously the canonical one; almost the entire purpose of a spreadsheet is to host small fragments of an embedded value-oriented programming language which calculates the values of cells.

Other applications which lean on customisation as their entire purpose may provide entire programming languages. For example, Zapier lets you create zaps using Python or JavaScript code.

What I'd like to know is, do you know of any minimal, well-documented languages which are oriented towards producing expressions - like Excel's calculation language - which can be embedded in web application frontends or backends?

I think Lisp is still the canonical "code as data" version of this, and the question becomes just "which Lisp can I embed most conveniently?", or maybe "which Lisp has few enough features?"

Other examples in the genre are JSON Logic[1] (which is essentially a Lisp written in JSON, which sounds like a nightmare, but may be fine for machine generated logic), Lua, which is of course another full programming language, or any number of custom scripting languages used in various places.[2]

Even Dhall[3] or Nix[4] have some similarities in that they're value-oriented configuration languages, though they're quite esoteric. I don't imagine they're often used in embedded fashion.

[1]: https://jsonlogic.com/

[2]: https://github.com/dbohdan/embedded-scripting-languages

[3]: https://dhall-lang.org/

[4]: https://nixos.org/guides/nix-language.html


  👤 nanomonkey Accepted Answer ✓
If you're looking to embed a lisp like language in webpages, you can use Scittle, which is a subset of Clojure, similar to babashka that is meant to be embedded in html:

https://github.com/babashka/scittle