I first saw this talk of DSLs with Ruby, where it is/was popular to use missing method and others to build your own "language".
I do not mean it in a negative way, but at the time it seemed like calling a utility class DSL was excessive. It just seemed like regular programming, using the language constructs. It also was not enforcing many boundaries (there are escape hatches).
Looking at all of this, would it not be easier to encode the DSL in something like json, and turn it into a data/format problem? Something like terraform. The implementation can then be in any language that can read json. One could imagine, for example, regex defined in json as a DSL.
I think every language (DSL or not) should support translation to/from a simple data representation for its syntax trees (whether s-expressions, JSON, XML, etc.). Not necessarily the same representation, but just something structured that existing tools can walk and transform, such that (a) we don't resort to grepping through bytes (and manually filtering out matches that are comments or strings) and (b) adding a keyword to a language won't break all existing tooling that's unable to parse it.
I would say JSON + schema, rather than just JSON. Like S-expressions, JSON saves you from having to implement a tokenizer, and a tokenizer is one of the easier parts of a DSL. You still need to implement something like a syntax, because things that are handled by the syntax now get pushed into later stages of the DSL. However, if you can provide a JSON schema for your language, then the problem is mostly solved !
On the other hand, it's not enough to read JSON, you need a JSON parser library that provides you with the position (line:column) of every JSON value, so that you can emit user-friendly errors.
I do not mean it in a negative way, but at the time it seemed like calling a utility class DSL was excessive. It just seemed like regular programming, using the language constructs. It also was not enforcing many boundaries (there are escape hatches).
Looking at all of this, would it not be easier to encode the DSL in something like json, and turn it into a data/format problem? Something like terraform. The implementation can then be in any language that can read json. One could imagine, for example, regex defined in json as a DSL.