Show HN: I'm 17 and wrote a guide on how to build your own programming language (easel.hackclub.com)
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
72 comments
[ 3.2 ms ] story [ 151 ms ] threadYou 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!
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
>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.
[1]: https://en.wikipedia.org/wiki/Turing_completeness#Examples
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.
Iterate through the list (start with n = 2) and iterate through until the fraction is an integer. Repeat with the new number.
For this, after 2, the next value is 15 (when it gets to 15/2). Then it will be 825 (15 * 55/1). Then it will be 725 (825 * 29 / 33) and so on. At some point, n will be 2^x where the sequence of when the number is just a power of 2 will be: 2^2, 2^3, 2^5, 2^7, 2^11 and so on... the exponents of 2 are the prime sequence.
2, 15, 825, 725, 1925, 2275, 425, 390, 330, 290, 770, 910, 170, 156, 132, 116, 308, 364, 68, 4, 30 ...
https://oeis.org/A007542
https://news.ycombinator.com/item?id=35966537
https://softwareengineering.stackexchange.com/questions/2201...
https://web.archive.org/web/20150923211455/http://www.cs.vu....
Typically you say that you can make arbitrary functions between any two closed domains using only NAND gates.
Anyway, bringing up Turing completeness is overly theoretical when talking about a programming language. It's pretty hard to make a language not Turing-complete, and it doesn't say much about what you can use it for IRL.
Exactly.
Now tell me how you will do unbound computation (ie. write on the n+1 cell in the Turing machine) with a fixed number og NAND gates and without a clock.
However, a RAM machine where the program counter is memory mapped, can be Turing complete with a [single machine instruction]( https://en.m.wikipedia.org/wiki/One-instruction_set_computer).
https://www.goodreads.com/book/show/89197.Programming_Langua...
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
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.
I'm saying this as someone who is relatively young, so keep that in mind.
The part where you build a demo/prototype showcasing if an idea works, I believe it should be much easier than before as long as you postpone understanding/deciphering the implementation. In those major ecosystems there are huge collections of single-purpose libraries doing a subset of what you want to do, all you need might just be a reasonable amount of python to string them together.
However, ensuring the correctness and actually deploying them for planet-scale mandates following a reasonable subset of "best practices" which is very overwhelming, but doable. People doesn't usually build planet-scale product 10-20 years ago.
I think this is specifically a big part of the problem. Not everything needs to be planet scale to be good. People didn't focus on being planet scale 10 years ago. 20 or so years Mark was worried about getting The Facebook available at one or two schools.
Worrying about getting things working for the world has made it way harder for us to get things working for indoviduals or small groups.
IMO, if we take the age out, some of show HN's might not look very interesting. Same goes for a Show HN where someone mentions they are not a programmer and yet built a thing.
For whether there should be comments about age being mentioned: existing guidelines already denounce low value commenting especially at the root level.
Even if you dislike "I'm $X years old and I $Y" posts, it's not helpful to give a kid a grumpy patronizing response. We want HN to be a helpful community, not some weird age competition.
Lots of middle aged people build cool things too, but they can't pull the age card to boost their rank on the front page (at least, not until they are at the other extreme - like 80 or 90 years old)
When I was 17 I was working on a programming language, and I promised myself I would find the time to finish it during college. But during college I didn't have the time.
I have two friends who founded a startup at 16, one of which was quite succesful. I can think of two seperate friends who started a Minecraft hostar at 16, both of which makes up the majority of minecraft servers hosted in the Netherlands currently and one of them is now a generic hostar with his own datacenter.
And this isn't a problem in and on itself, but phrasing it like this discourages older people to work on pet projects. I started working as a Cyber Security TA at a private IT school and older students keep telling me "I'll never be as good as you because I didn't start so young" and it's a harmful mindset. Because it only took me a few years to learn what I know. Stating your age everywhere as a young developer reinforces this mindset in people.
If you want to see a teen/student do cool stuff. I suggest checking Adam McDaniel on GitHub. That dude really is impressive.
I did lots of cool stuff "for being made by a 17yo" but in retrospect it was not objectively great.
I never stated my age on my projects when I was younger. Neither did any of my developer friends.
In this conversation I see people discussing the requirements for being Turing complete. Because OP is a teen, everyone so far seems pretty nice about gently pointing out inaccuracies. I doubt they would be, or should be, as easy on me if I made similar misstatements.
And that's the value I see in "as a teenager..." here. It's not so much about their age as that they don't have decades of education and experience under their belts. Another person posting "as a professional dog groomer..." might get similar responses: hey, that's pretty neat coming from someone who hasn't been doing this for a living for many years!
Ignore the grumpy haters in this thread and keep going.
Side note, I'd discourage leaning on your age/precociousness when doing stuff like this. It's a strategy with a limited shelf life, and sooner or later your work will have to stand on its own merit anyway.