Hey HN,
Indian Highschooler here, currently prepping for JEE, thought itd be nice to share here.
three years ago in 9th/10th grade I got a knack for coding, So I taught myself made a custom compiler with LLVM to try and learn C++.
so I spent a lot of time learning LLVM from the docs and also C++ so its not some marvelous piece of engineering,
It has:
– Basic types like bool, int, double, float, char etc. with type casting
– Variables, Arrays, Assign operators & Shorthands
– Conditionals (if/else-if/else), Operators (and/or, arithmetics paranthesis etc)
– Arrays and indexing stuff
– C style Loops (for/while) and break/continue
– Structs and dot accessing
– extern C interop with the “extern” keyword
Some challenges I faced:
– Emscripten and WASM, as I also had to make it run on my demo website
– Learning typescript and all for the website (lol)
– Custom parser with basic error reporting and Semantic analysis was a PITA for my undeveloped brain
– Learning LLVM from the docs
Important Learnings:
– Testing is a very important aspect of making software, I skipped it – big regret
– Learning how computers interpret text
– Programming in general was a new tour for me
– I appreciate unique_ptrs and ownership
Its on my github and there’s a link to my web demo (https://vire-lang.web.app/), it might take some time to load the binary from firebase.
Very monolithic, ~7500 lines of code,
I’d really appreciate any feedback, criticism, or pointers on how I could’ve done this better.
Comments URL: https://news.ycombinator.com/item?id=46925562
Points: 1
# Comments: 0