
Learn to build configuration file readers, data readers, model-driven code generators, source-to-source translators, source analyzers, and interpreters. You don’t need a background in computer science—ANTLR creator Terence Parr demystifies language implementation by breaking it down into the most common design patterns. Pattern by pattern, you’ll learn the key skills you need to implement your own computer languages.
Language Implementation Patterns by Terence Parr. It avoids the theory in other books, going for a more practical approach.
Then it was just trying a lot of programming paradigms like functional programming with Common Lisp and Clojure, logic programming with Prolog, array and stack programming with Uiua. And reading snippets of books and papers. It was chaotic.
But the most enlightening lesson was: Formalism is the key. You define axioms, specify rules and as long as you stay consistent, it's ok. The important thing is to remember the axioms and understanding the rules.
[0]: https://www.youtube.com/playlist?list=PLUl4u3cNGP60_JNv2MmK3...
Two other books that I like from them are "Language Implementation Patterns" and "Distributed Services with Go".
> I would love a book that goes into detail about different parsing techniques and considers best practices and patterns and tradeoffs/design considerations -- would pay good money for that
Terrence Parr's "Language Implementation Patterns" spends quite a bit of time on parsing, and parse tree->ast conversyions.
Has been invaluable for creating the AST (and soon the IR nodes)-- though it has been a source of much yak shaving as I've rewritten my asdl generator at least 3 times.
Language Implementation Patterns: Create Your Own Domain-Specific and General Programming Languages Book, Terence Parr
Pretty java/antlr focused but wasn't too hard to take the concepts and apply them to a C++ based transpiler I've been slowly poking at.
Combining Analyses, Combining Optimizations, Cliff Click
His thesis and an extension of the linked paper Global Code Motion, Global Value Numbering -- my next step down the rabbit hole...
Tree Automata Techniques and Applications, Comon et al.
Still on the fence on this one vs the iburg/burs algorithm, probably be more useful and match better with the way Parr's book goes about things.
To have a 'proper' DSL I reckon you need two things, and understanding that a thing can and should be broken out into its own sublanguage, and the ability to do so. The first takes a certain kind of nouse, or common sense. The latter requires knowing how to construct a parser properly and some knowledge of language design.
Knowing how to write a parser is not particularly complex but as the industry is driven by requirements more of knowing 'big data' frameworks rather than stuff that is often more useful, well, that's what you get, and that includes people who try to parse XML with regular expressions (check out this classic answer <https://stackoverflow.com/questions/1732348/regex-match-open...> Edit: if you haven't seen this check it out cos it's brilliant).
I think this reflects the fundamental problem in software development of the market's not knowing what's actually needed to solve real business problems.
++++
Edit, some reading material
https://www.amazon.co.uk/Language-Implementation-Patterns-Do...
https://www.amazon.co.uk/Definitive-ANTLR-Reference-Domain-S...
https://www.amazon.co.uk/yacc-Nutshell-Handbook-Doug-Brown/d...
They're all worth investing the time in.
https://pragprog.com/titles/tpdsl/language-implementation-pa... Language Implementation Patterns Create Your Own Domain-Specific and General Programming Languages by Terence Parr (Antlr)
https://craftinginterpreters.com/ by Bob Nystrom
https://interpreterbook.com/ Writing An Interpreter In Go by Thorsten Ball (also has a compiler book)
The Implementation of Lua 5.0 (short) https://www.lua.org/doc/jucs05.pdf
A Deep Introduction to JIT Compilers: JITs are not very Just-in-time https://carolchen.me/blog/jits-intro/ by Carol Chen
video series: JIT programming language development in C https://www.youtube.com/watch?v=k3gDvF-Fbpw&list=PLvdK1vRmp8... by Dmitriy Kubyshkin