After going through the plan for 2026 last time and musing about game engines the week before, it’s finally time to get into the thick of it.
This is the first part of a series of posts that will go through the Domain Specific Language (DSL) I’ve created for developing my games, called Enaml. This first post will go through the basics so I can get to the good parts today. Later I will talk about inspirations and specifics.
Basic structure
The foundation of the language is really simple:
- A document is an ordered tree of nodes
- Each node is a line in the document (with exceptions, see below)
- Nodes have a single string template for text and/or a set of tags for data
- Terms in all-caps are variables, other terms are constants
Whitespace matters; the nodes’ locations are determined with indentation. There’s also comments and some tags do funky things but otherwise that’s pretty much it for the basics.
Example
The above definition is pretty high level so here’s an example bit of menu definition:
:menu .flow.y ?SYSTEM.menu.main
"New game" +SYSTEM.menu.new-game
"Load game" +SYSTEM.menu.load-game
"Quit" *quit
(I’m looking into custom highlighting but for now I’m using C highlighting as a placeholder)
Because I am programming with Clojure, in practice this gets turned into an EDN data structure for the code to read, which would look like this:
{:node/key :menu ; locally unique key for this node
:node/path [:menu] ; full path to this node; also node's GUID
:flow :y ; this makes children form a column
:node/conditions [['?SYSTEM :menu :main]] ; datalog :where clauses
:node/children [{:node/key :_0 ; automatically determined
:node/path [:menu :_0] ; note parent key :menu in path
:node/text "New game"
:node/effects [[:db/add '?SYSTEM :menu :new-game]]}
{:node/key :_1
:node/path [:menu :_1]
:node/text "Load game"
:node/effects [[:db/add '?SYSTEM :menu :load-game]]}
{:node/key :_2
:node/path [:menu :_2]
:node/text "Quit"
:node/effects [[:quit]]}]}
Of course this is a little unfair to compare these since above we use some tricks to make authoring easier like automatic keys and paths. We could also do these for the EDN. So here’s a more author-friendly version of the above EDN:
{:node/key :menu
:flow :y
:node/conditions [['?SYSTEM :menu :main]]
:node/children [{:node/text "New game"
:node/effects [[:db/add '?SYSTEM :menu :new-game]]}
{:node/text "Load game"
:node/effects [[:db/add '?SYSTEM :menu :load-game]]}
{:node/text "Quit"
:node/effects [[:quit]]}]}
This is more reasonable. You could definitely write this by hand.
But it still has more than double the number of lines and more than three times the number of characters (including whitespace) than the Enaml version. But more than that you can also see that further nesting would quickly make the line width go out of control.
You could alleviate this a bit by removing the namespaces from the keywords. Or flattening the effects and conditions to dot-notated keywords. But that only removes a fraction of the characters. And you would still need to write a lot of boilerplate for the keywords.
There’s also other benefits that don’t really shine here since this example is so simple. Like custom syntax highlighting and special syntax for multiline strings, etc.
Benefits and drawbacks of a DSL
Now am I claiming Enaml is superior to EDN? Of course not. This example is so egregious because Enaml is a language for a very specific purpose while EDN is a generic data notation language for all kinds of things.
For one, I already know the schema the data is supposed to fill. I know that effects and conditions
are parsed into Datalog queries and transactions. I know that flow is a single scalar value and
others are vectors or maps.
There’s also limitations. For example, Enaml does not currently support floating point numbers. It doesn’t really play well with the dot notation used for tags. I could add special syntax for it if really necessary but for now it has not been.
And as stated above, a node can have only one string value. Other strings have to be added as child nodes.
This means the data is also a little unoptimized. Enaml does not care if you are making a map, list or set. A node is always a hash-map with a vector of child nodes.
For an opposite example, the worst case scenario for Enaml is something like this:
["apples" "oranges" "bananas" "pears" "grapes"]
Which would need six lines to reproduce as Enaml (left as an exercise for the reader). Actually, a nested set of vectors, maps and sets would be even worse. But that’s not really a good idea with EDN either.
But these are trade-offs you can (and should) make when designing a Domain Specific Language. The whole point is to focus on the things that matter to your use case.
As with engines, you should only make your own if existing ones don’t meet your needs, and you should know what those needs are.
Next time
You can probably deduce a lot of the functions here from these examples, at least if you know EDN. Next time in part 2 and part 3 I’m going to go more into detail though and go through all the tag types, including ones we didn’t see here like inheritance or overwrite tags.
Until then, hope you have a good week.
EDIT 2026-10-27: Reading this now, looks like I forgot to mention something a DSL has over an existing format and I don’t want you to think that brevity is the only thing I care about. One other deciding benefit of a DSL is that I can attach source metadata to nodes and use it when an error arises.
The error message can then point to the exact file and line number the author should go for debugging, instead of an abstract path. Next time you will see how this is relevant for data inheritance and flexible file composition.

