3 ms·
I love creating programming languages! They're powerful tools of abstraction - designed well they make complex concepts look simple. Couple of examples - a lan
by DorothySim 10y ago
I love creating programming languages! They're powerful tools of abstraction - designed well they make complex concepts look simple.
Couple of examples - a language that compiles to Bitcoin script opcodes [0]. Although the Bitcoin script engine is stack based (easier to follow) I couldn't resist designing a small, simple language that could be used to write transaction output scripts. This way it's easy to understand what are the conditions of moving funds to the next owner.
Another language has first-class functions, operators as functions, optional lazy computations, but more importantly a small runtime that supports tail-calls and capturing execution as a value (callcc) [1].
I've also written parser and interpreter for Prolog [2], just to get the feeling of logic programming.
Writing a small language can make you understand the paradigm (functional, imperative etc.) better and it takes a great deal of effort to decide how should the syntax look like, how will the runtime work (usually with toy languages you provide runtime too...).
Edit: Just noticed the "except toy languages" part... :-/
[0]: https://curiosity-driven.org/bitcoin-contracts https://curiosity-driven.org/bitcoin-contracts
[1]: https://curiosity-driven.org/continuations https://curiosity-driven.org/continuations
[2]: https://curiosity-driven.org/prolog-interpreter https://curiosity-driven.org/prolog-interpreter