An Old Passion
I've been interested in writing a programming language ever since using Simon's BASIC on the Commodore 64.
I finally worked through Thorsten Ball's Writing an Interpreter in Go, implementing the book's Monkey language in C# as I went.
The Monkey Language
Ball's book is an excellent introduction to interpreters and parsing. Go was unfamiliar to me at the time, so translating the implementation into C# also made for an interesting language exercise.
The code is available on GitHub here.
The implementation includes variables, functions and closures, conditionals, arrays, hashes, built-in functions and recursion. The REPL maintains definitions throughout the session, so it's possible to interact with Monkey much like a small programming language rather than simply evaluating isolated expressions.
let newAdder = fn(x) { fn(y) { x + y } };
let addTwo = newAdder(2);
addTwo(40)
# 42
One difference that struck me was organization. I've always liked Delphi's concept of a unit. Assemblies are large, while individual C# classes are granular and the conventional one-class-per-file approach can result in an explosion of files. The Go implementation felt remarkably succinct by comparison. I had to resist collapsing all my node classes into Nodes.cs and the object classes into Objects.cs.
Summary
For anyone interested in how parsers and interpreters work, I highly recommend working through Writing an Interpreter in Go. It's approachable, practical, and was a very enjoyable project to reproduce in C#.
Next on my language-reading list: Robert Nystrom's Crafting Interpreters.