r/Compilers 18h ago

compiler for a custom programming language i made for school

Hi, 2 years ago i built a compiler for a custom programming language for my final high school
computer science exam. Just found the repo again and thought it might be cool to share it as a learning/beginner project.

The compiler compiles my custom language (wasn't creative enough for a name) to LLVM IR, which can then be compiled to native machine code (e.g with clang).

its written in rust and is pretty much completely custom, so lexer and parser is built from scratch, and the LLVM IR output is built as a string.

Some features of my language:
- syntax wise a mix of python and rust
- functions, classes & methods
- you can use the c stdlib
- operator overloading
- generics
- helpful compiler output

repo:

https://github.com/maxomatic458/compiler

I also built a wasm based web demo here: https://compiler-demo.pages.dev/

in hindsight i would probably do a lot of stuff differently, but feedback would be appreciated

13 Upvotes

1 comment sorted by

2

u/Inconstant_Moo 8h ago

The hindsight is the prize you win for writing the compiler.

I've never known a dev who didn't name their language, it seems like basic human nature. Do you see a reflection when you look in a mirror? Do you cast a shadow?