7 ms·
Show HN: I'm 17 and wrote a guide on how to build your own programming language
Hey! I’m JC. I’m 17 and part of Hack Club, a nonprofit where we help teenagers ship programming projects with their friends while growing technically.
A while ago, I asked myself the question, “How exactly do programming languages work behind the scenes?”
It seemed really daunting until I went to a half hour workshop at a high school hackathon about writing a tree-walk interpreter and realized that getting started was actually super fun.
This guide is designed in the vein of that - to get people, especially teenagers, started on learning how to build a programming language in a literal weekend by actually shipping one. It’s a stepping stone for learning the big things - compilers, optimizations for performance, etc.
It’s very inspired by Crafting Interpreters and why’s poignant guide, but meant to be approachable in a weekend.
Some backstory on me: A year ago I finished high school early and joined Hack Club full-time to build projects like this. I’ve been programming since COVID, and learned how to code primarily by shipping things that seemed daunting to me and taking inspiration from people taking the time to break down various topics online.
Give it a try and take it out for a spin! Constructive feedback is also really appreciated.
It’s open source on GitHub at https://github.com/hackclub/easel https://github.com/hackclub/easel
- codetrotter 2y agoVery cool. I especially like the programming language jam, and the fact that the guide pairs with it.
- kunley 2y agoThat's great! You have excellent inspirations, both of them. It's also awesome that your adventures with parsers happen quite early in your coding life, that's a big plus, you will look at things from different perspective. (Btw, contrary to some other commenters here, I think it's great you have mentioned your age xD). Btw, I totally recommend getting into VM-based approach from the second half of Robert Nystrom's book. It's not only closer to how hardware works, but also it resembles how early compilers were written when memory was scarce. I implemented stuff based on that approach and learned a lot, even though I am coding for thirty years. If you had some comments, questions or even already hacked on that, I'd love to hear about it - you can find the email on my profile page here. Good luck!
- zerojames 2y agoCongratulations on launching the project! Making a programming language is a great way to better understand computation and start to explore different means of expressing concepts in code beyond those available in existing languages. Programming languages are a difficult concept to get one's head around. Having one that implements a lexer, parser, and execution engine -- and is packaged as a resource for others to use -- is an impressive technical feat. Writing a guide so others can learn is doubly impressive. Asking a question like "How exactly do programming languages work behind the scenes?" is a great quality to have in your creative pursuits. Not to mention that such questions are the basis of HN: journeys that satisfy our creative curiosities. Keep making cool things! --- One piece of feedback: I find the size of the code instruction boxes on the page a bit small. There are no visual indicators that I need to scroll down to see all of the code. I would love for the boxes to be taller so I can read the code and retain all the context without scrolling. --- Another idea: You may enjoy writing a post about what you learned making the language. What did you find more difficult than you thought? What challenges did you run into? How did you solve them? Why did you choose the syntax you used? I love reading about the how behind cool projects :D
- andoando 2y agoVery cool. Someone correct me if I am wrong but I dont think this is accurate. >Minimally, should have the following features: variables, looping (think: for/while loops), conditional branching (think: if/else statements) and some form of recursion (think: functions). Why? These are what make a programming language Turing-complete.
- hot_gril 2y agoOn the practical side, I can think of one Turing-complete language people actually use that doesn't have loops or variables: Erlang.
- svieira 2y agoEither an infinite for/while and if or unbounded recursion are necessary but you don't need both for Turing completeness. [1]: https://en.wikipedia.org/wiki/Turing_completeness#Examples https://en.wikipedia.org/wiki/Turing_completeness#Examples
- andoando 2y agoMy understanding is theyre two sides of the same coin. Any loop can be written recurisvely or iteratively. And a loop is really just a move to the same instruction, or equivalently a replication of the same instruction.
- thequux 2y agoEither conditional looping (like the for loop in C) or recursion is enough for Turing completeness. Practically speaking, conditional looping generally requires mutable variable bindings, but I can imagine a SSA-based language where variables are unnecessary. With recursion, you have no need for mutability as the function call primitive gives you the variable rebinding you need.
- nferraz 2y agoIn fact, NAND gates are enough to build a Turing complete machine. ;-)
- mise_en_place 2y agoExcellent work. When I was your around your age, it was QuakeC that exposed me to programming concepts and really sparked my interest in programming. If you’re interested you may want a follow up project to create a stack or register based VM.
- slushy-chivalry 2y agoValve GoldSrc for me
- 8338550bff96 2y agoIf I were to pick one book that has had the most impact on how I think about programming languages it would be the textbook Programming Language Pragmatics by Michael Scott. https://www.goodreads.com/book/show/89197.Programming_Language_Pragmatics?ref=nav_sb_ss_2_27 https://www.goodreads.com/book/show/89197.Programming_Langua...
- dang 2y ago[stub for offtopicness]
- IncreasePosts 2y agoI don't think you need to lead with your age. It's a cool project and you should be proud of it regardless of your age.
- megraf 2y agoAs a 30 something, I completely agree.
- smith7018 2y agoTotally unrelated to the content of your post but labeling posts with "I'm [a teenager] and X" has always irked me. It either serves to undermine the content (older people immediately questioning the authority of a teenager) or people respond with meaningless praise ("Wow, great job! I was playing video games when I was your age!"). It also harkens back to the 2000s and 2010s when the industry was obsessed with "teenage savants" for some reason. So much money was wasted by being thrown at teens due to tech's obsession with youth and the errant belief in its ability to drive innovation. Your post could have been titled "Show HN: I wrote a guide to help teens learn how to build their own programming language." I dunno, maybe I just need my coffee and I'm being grouchy
- stephencoyner 2y agoThere’s been a concerning trend of less and less young, successful founders. Where is the modern Zuck, Gates or Patrick Collison? I say good on OP for putting themselves out there and keep pushing. We need young people to come up with great ideas and if that comes with them pointing out how young they are, I’m totally fine with it.
- deleted 2y ago[deleted]
- 2y ago
- slantedview 2y agoReally cool - I'm looking forward to reading through this. Since you mention, Crafting Interpreters, how would you compare this guide to that?
- quraai 2y agoThis is amazing, love the work JC
- chris_mnhn 2y agoThis was an awesome read, really amazing job. Most particularly though, I love your style of teaching through storytelling. I was so captivated by the story; it's not just a guide or tutorial, but it adds another layer of mental stickiness. Are you planning to write other guides like this about other programming topics?
- blacktechnology 2y agovery cool