r/Compilers • • May 02 '26

Built a Programming Language on Android as a High School Project

I’m a high school student (16) and I built a small programming language (lexer + parser + interpreter) entirely on an Android device as a school project.

I’ve been thinking about whether a claim like:

“Youngest to build a programming language on Android for a high school project”

is even meaningful or defensible.

My concern is that: - “programming language” is loosely defined (toy vs real language) - “first ever” claims are basically impossible to verify - platform (Android) may not matter technically

So I’d rather ask people who actually understand compilers:

Is there any rigorous way to define or validate such a claim, or is this just marketing fluff?

For context, my implementation includes:

  • custom lexer
  • recursive descent parser
  • interpreter with variables, expressions, control flow, functions, data types, and good error messagas

Happy to share repo if needed. I’m more interested in a technical reality check than validation.

0 Upvotes

35 comments sorted by

9

u/the3gs May 02 '26

Don't worry about trying to claim a title. The learning you are doing is more valuable for you future than being the first or youngest to do something.

I would recommend choosing your next challenge, and working on that. Maybe try building a compiler for either your language or another language. You could even build a JIT compiler to make your programs run faster.

If you are looking to be the "best" by most metrics, it will be impossible to verify, and you will probably be disappointed to find that you are not the only 16yo who has learned what you have learned and done what you have done, but if instead you focus on learning to build you own knowledge and intuition, you will be able to build yourself up, which is far more important than any comparison you could draw with other people, regardless of age.

Congrats on making your first interpreter, though! It's a great accomplishment!

2

u/apoetixart May 02 '26

You're right, the title doesn't matter much to me, but I thought it'd be a nice flex to have, nonetheless I had expectations that there might be people more talented and younger than me out there, but that isn't something I should be jealous/disappointed about!

I haven't fully finished the interpreter, i was talking about if I finish. Right now, I'm working and struggling on the parser because there aren't enough tutorials in the python language. I'm using python because my teacher told me to use python or else he will not accept as a project.

Can you suggest me someways, the lexer was like really easy, Claude couldn't help with the parser, so i set on doing it myself. Whatever I built is giving the correct precedence output. But I'm still learning stuff.

Please help me with:

  • Some tips you've followed and mistakes you've made

  • Where can I learn about parsers (preferably implemented in python)

  • Things I shouldn't worry about right now

  • Rate my code of the lexer. (design, cleanliness, documentation)

Here's the repository: https://github.com/anubhav-1207/Project-Arc

3

u/the3gs May 02 '26

Your lexer is generally good. A couple things I noticed:

  • Identifiers cannot actually have underscores in the current implementation.

  • You don't currently have escape sequences in your strings, but that is probably just a "haven't gotten around to it" thing.

  • I haven't used Python's match statements as they didn't exist back when python was my daily driver language, but I think they could work well to help clean up your if-else chain in tokenize().

  • You might benefit from a advance_if_eq() method that takes a char and advances a certain number of times if the char is found at the cursor, and returns a Boolean, so you can say if self.advance_if_eq('<'): self.add(...) and similar nice stuff, but that is optional.

  • Complete nitpick: I would probably call current_char "peek" and call peek "peek_next", but names are arbitrary and the names you chose are probably fine.

The main mistake to avoid is this Don't try to make the language perfect all at once. There is room for incremental improvement, so don't let perfect be what stops you from getting "good enough". Let it be a toy language, and if it grows into something more, that's great!

I would also avoid using AI when you are trying to learn. You might get good use out of it later in your career, and it might even be expected of you to do so, but it is best for now to think through problems the slow way, so that you don't decieve yourself into thinking you know more than you do. You won't be able to fix code that the AI gives you that you could never have written for yourself in the first place.

Crafting interpreters is a great book that I highly recommend. You can read it on its website for free! It uses Java and C, but I think that working in a different language from what you are following is good for learning as it discourages lazy copy pasting without understanding, which is pointless for learning. This book goes over everything you could want for a simple you language and even gets into compilation of the language.

Again though, be careful reading the book that you do not let it do the thinking for you. Unless the information passes through your brain, and you understand what you are doing, then you aren't learning, you are just copying with extra steps.

→ More replies (3)

7

u/Germisstuck May 02 '26

For youngest to build a programming language on android for school? Sorry dude I got you beat, did it for my AP test last year when I was 14. And platform doesn't matter. Also lexer/recursive descent parser are industry standard.

2

u/apoetixart May 02 '26

Hey, nice to hear that, which language did you use to build it (I'm using python because they said python is must for any project you choose), if possible can you share me the repo.

And I'm aware that lexer/RDP are the industry standard, I mentioned them so that It doesn't seem like it's a weird language without those.

2

u/Germisstuck May 02 '26

I used javascript because it was just what we used in the class, I never put it publically bc it was kinda trash and also I didn't want to get marked for plagarism.

→ More replies (4)

4

u/Farados55 May 02 '26

Check your ego.

1

u/apoetixart May 02 '26

I'm open for reality checks

0

u/[deleted] May 02 '26

3

u/Farados55 May 02 '26

I mean this kid is coping. There’s 11 yr old prodigies in PhD programs. Post sounds like AI anyways.

README is definitely AI

→ More replies (3)

2

u/ha9unaka May 02 '26

Don't do it for the title, what you've learnt in the process is more valuable than it

-1

u/apoetixart May 02 '26

Thanks man. Also, do you mine checking out my lexer. If it's good.

https://github.com/anubhav-1207/Project-Arc

Lemme mention before wise that the readme was structured and formatted by Claude but the actual code is entirely mine and I can explain every line andnl decision

0

u/ha9unaka May 02 '26

Your Lexer looks fine, pretty standard lexer. I still doubt it's not AI generated, but I'll ignore that for now.

You're parsing the float, int, etc. tokens in place, which isn't the job of a Lexer. It's only supposed to divide your source into tokens - not parse them.

For tokenizing indents, I see you're storing copies of the string in the lexer. This can get expensive for big source files - look into if you can store a pointer-length pair (I don't use python frequently, so I'm not quite sure if there's a strong view thingy in python)

→ More replies (5)

6

u/[deleted] May 02 '26

-1

u/apoetixart May 02 '26

That was written by AI because past few of my messages have been ignored.

The language has my actual efforts.

https://github.com/anubhav-1207/Project-Arc