Building a Statically-Typed Language from Scratch in C++17

I wanted to understand how programming languages actually work. So I built one. Nova is a statically-typed language I wrote from scratch in C++17. Not just a parser or a toy interpreter, a complete toolchain: The compiler has a lexer, parser, semantic analyzer, multi-pass optimizer, and code generator. It targets three backends: a stack-based bytecode VM, a JIT compiler that emits x86-64 machine code, and an LLVM IR generator. The language supports generics with monomorphization, traits with bounded generics, enums, pattern matching, first-class functions, closures, and a module system. Memory is managed by a mark-and-sweep garbage collector. But I didn't stop at the compiler. I built a step-through debugger, an LSP server for VS Code with diagnostics, hover, go-to-definition, and autocomplete, and published it as a VS Code extension on the marketplace. Then I compiled the whole thing to WebAssembly so anyone can try it in the browser. 196 tests. Zero external dependencies. Everything from scratch. Try it: https://lnkd.in/dMYy9jFA Code: https://lnkd.in/dCss3vb4 Extension: https://lnkd.in/dMnsXSPf #programming #compilers #cpp #webassembly #computerscience #softwareengineering

  • text

insane! was it AI assisted at all?

Nova looks like coding rust, but with less of a headache. cool project.

How much time you have taken developing it ?

Like
Reply

Very interesting, and congrats on all the progress you've made on this!

I like your example program.

I like the comment that Jak Brierley left - "What did you learn?" With AI assisted development, the delivery of features is often treated as a prompt task to simply rephrase the customer's requirements with a minimal of critical thinking. Designing something out of whole cloth is different. You have decisions to make, and what inputs do you have for decision making? Data collected from others, learning you've had either in an academic sense, or experience, and guidance that our tools give us. Making decisions, good and bad is the feedback loop that we all need, and great developers add fearlessness of hard work to obtain the wisdom collected from mistakes to guide future actions. That's what impresses me here - your willingness to take chances, learn, make mistakes, learn some more and keep pushing the envelope. But don't let the AI guide you. Your work is ultimately your responsibility, and your decisions guide it. Ultimately, what separates good from great is critical thought, and as Jak said, what did you learn?

I like it, it sounds like rust but with GC.

Like
Reply

Reminiscent of kotlin and rust. Cool.

Like
Reply
See more comments

To view or add a comment, sign in

Explore content categories