Show HN: Xlerb – A Compiled "Forth" for the Beam

4 points by shawa_a_a 8 hours ago

Hello

I've been working on a small stack language for the BEAM in my free time called 'Xlerb'.

I read Starting Forth and thought it would be interesting to see if you could send messages to other stacks etc, and the BEAM seemed like a great fit.

Xlerb is a small leex/yecc grammar and a simple-ish compiler that takes Forth-ish code and turns it into regular BEAM modules.

The modules it produces just export functions from stack to stack, so there's a good interop story with Elixir/Erlang (if you'd ever want to do that?).

I've the syntax a bit beyond a 'strict' forth with pattern matching, that makes it feel a bit more natural of a BEAM language (with different function heads etc). It was a fun exercise translating that into the Erlang primitives of case, send, receive etc.

I've got a website at https://xlerb.wtf with a bit more, and you can get the code/compiler/repl at https://github.com/shawa/xlerb

Let me know what you think!