Types and Programming Languages (TAPL) is required reading, in my opinion: https://www.cis.upenn.edu/~bcpierce/tapl/
Ask HN: What's a starting point for learning how to write programming languages?
11–20 of 105 posts
Re: Ask HN: What's a starting point for learning how to write programming languages?
#12I've captured the entire process on video: https://www.youtube.com/watch?v=0_PX2Ue6F_A&list=PLWMUVtnFsZ...
The YouTube playlist is an archive of my daily streams on Twitch.
Re: Ask HN: What's a starting point for learning how to write programming languages?
#13Re: Ask HN: What's a starting point for learning how to write programming languages?
#14Re: Ask HN: What's a starting point for learning how to write programming languages?
#15After that, it's a question of where you want to go with your language, and what distinguishing features you'd like it to have relative to other languages. Languages which just change some syntax and keywords but otherwise look like C are common, but they tend not to get usage beyond their creators. Much of the academic research lately is about type systems (TAPL has already been mentioned) - there's research into dependent types, effect typing, total functional programming, linear types already made it into Rust's borrow checker, etc.
However, many of the worst problems in industry - dependencies, versioning, smoothly migrating from a prototype to robust production code, code navigation, security, parallelization & distribution, the memory hierarchy - have gotten relatively little attention in academic research, and are desperately awaiting solutions. If you have some industry experience, it may be worth trying to imagine how you might fix these problems if you were allowed to change the programming language at will.
[1] https://en.wikipedia.org/wiki/Compilers:_Principles,_Techniq...
[2] http://web.mit.edu/alexmv/6.037/sicp.pdf
[3] https://www.amazon.com/Modern-Compiler-Implementation-Andrew...
Re: Ask HN: What's a starting point for learning how to write programming languages?
#16The idea was then to have a language that maintains the elegance and clarity, and a compiler that generates in my case C code. This let me focus on the "core" of a compiler, without too much emphasis on parsing, tons of optimizations, corner cases.
So this would be my advice. Pick a domain, maybe focus on getting highly optimized code, design a small language and build your first compiler.
Re: Ask HN: What's a starting point for learning how to write programming languages?
#17There's also a followup article implementing additional data types and tail call optimization. http://norvig.com/lispy2.html
Re: Ask HN: What's a starting point for learning how to write programming languages?
#18https://www.elsevier.com/books/programming-language-pragmati...
If you like excellent free university lectures online, this is great:
https://www.youtube.com/watch?v=3N__tvmZrzc
In reality - programming languages are most likely what you think they are, if you simply start with the basics like what's a variable, what's a function. How do I call functions inside other functions. Do I want variables to have types. What kind of types?
If you start with the very very basics - global variables, global functions, you can't call functions within other functions - and implement that, you'll get the feel for it, which is most likely as far as you'll want to go, because it gets very tedious, very quickly, as soon as you want something as 'simple' as proper unicode support, garbage collection, generics, inheritance, foreign-function-interface and the list goes on and on.
To get your feet wet regarding what it's all about - those video lectures above are top notch.
Re: Ask HN: What's a starting point for learning how to write programming languages?
#19I would recommend a lot of books here as well for a solid base and giving you the background needed to write more complex languages including static types, compilers, JITs and VMs. But for me, because I really do not have that much time, that would stretch over too long time and I lose interest, so I stick to things I know I can finish (or rather, get working and achieve something a previous incantation did not achieve; smallest, simplest, fastest etc).
[1] https://gist.github.com/tluyben/16ee2645c4c8aed813005d51488d...
Re: Ask HN: What's a starting point for learning how to write programming languages?
#20Check out "Writing An Interpreter In Go" https://interpreterbook.com/ It uses Golang to make an interpreter for a simple C-Style language and it's "only" 200 pages long. I'm about a third in and my head is smoking.