I'm trying to learn how to create my own programming language, but I'm struggling to find clear resources. Most tutorials I've seen either skip over important code snippets or make huge leaps in complexity, making it hard to follow along. I'm aware that I need to work on the lexer, parser, compiler, and all that techy stuff, but I'm looking for a step-by-step guide that actually explains the process in detail—ideally in JavaScript if possible! Any suggestions?
4 Answers
Don't forget to check out r/ProgrammingLanguages for more discussions and resources! It's a great community with lots of useful information.
Here are a few resources you might find helpful:
1. Writing a scripting language in C#: [https://medium.com/@jmickle_/writing-a-scripting-language-e84cfe903ce](https://medium.com/@jmickle_/writing-a-scripting-language-e84cfe903ce)
2. How to create your programming language: [https://www.freecodecamp.org/news/the-programming-language-pipeline-91d3f449c919/](https://www.freecodecamp.org/news/the-programming-language-pipeline-91d3f449c919/)
3. A book on writing a C compiler: [https://nostarch.com/writing-c-compiler](https://nostarch.com/writing-c-compiler)
4. A JavaScript guide: [https://eloquentjavascript.net/12_language.html](https://eloquentjavascript.net/12_language.html)
Also, if you're looking for quirky inspiration, check out these fun programming languages: SkibidiLang and TrumpScript. Creating a programming language is a big task, but take it step by step, and you'll get there!
Looks promising, but I don’t know anything about C. Is that a problem?
Check out this step-by-step guide on writing an interpreter in Go: [https://edu.anarcho-copy.org/Programming%20Languages/Go/writing%20an%20INTERPRETER%20in%20go.pdf](https://edu.anarcho-copy.org/Programming%20Languages/Go/writing%20an%20INTERPRETER%20in%20go.pdf). It could be useful, even if you're using JavaScript. Good luck!
Ooh, I might need to check that out too. Just gotta learn Go first, I guess!
Consider checking out MIT's 'The Art of the Interpreter': [https://dspace.mit.edu/bitstream/handle/1721.1/6094/AIM-453.pdf](https://dspace.mit.edu/bitstream/handle/1721.1/6094/AIM-453.pdf). Writing a Lisp interpreter is often simpler for beginners, and once you're comfortable, you can move to something more complex. Also, watch this video for more insights: [https://www.youtube.com/watch?v=OyfBQmvr2Hc](https://www.youtube.com/watch?v=OyfBQmvr2Hc). It starts off well!
Thanks! I like that last JavaScript one, but I might need more details or examples...