Making a compiled programming language

Hi. So I am currently starting a new programming language called Bite and this language is aimed to further advanced features to work with memory as well as advance features for low level development that not only make it easier to do but more readable/flexible.

Bite is interpreted as of right now, but that is actually a really BIG issue because Bite is going to be dependable on being fast.
And this is where the issue emerges. A compiled language tends to run faster than interpreted languages and this is why I NEED to make Bite compiled.

C'mon now, lets be serious: Would it make sense to make a low-level language aimed to make low-level development easier if it is interpreted? NO!

So, here's the question

Does anyone know any documentation(or articles) that will be helpful as to going step by step(or just explaining) how to create a compiled programming language.

I have researched it multiple times before but maybe I am not digging deep enough and I often run into time issues/time stumps.

So, will anyone be willing to help me?? Please and thank you, it will be much appreciated.


I know that a compiled language gathers all of the source code, tokenizes it, and builds a Syntax Tree off of the tokens, I just always find myself needing a runtime and this is where I get a bit confused as to where the compiled side of things comes in at.

Any help would be great!


You are viewing a single comment. View All
Answered by Viper2211 [earned 5 cycles]
View Answer

I know that the accepted answer is, but I actually find Nora Sandler's guide very helpful. It sadly isn't complete, but it does a great job of keeping things simple and balancing between showing you stuff and having you do stuff. And, even though Sandler's guide is incomplete, by the end of it I had the knowledge I needed to continue building my compiler. I'm not trying to say that craftinginterpreters is bad, I just think that it might be a lot to take in for a first time building a compiled language.

However, the opposite could be true — Sandler's guide compiles directly to machine code, a "true" compiler, while crafting interpreters compiles to a virtual machine. The virtual machine approach will naturally be slower, but might be easier to translate to — finding documentation for x86 can be tricky sometimes, but if you make the VM you'll know how it works.

In the end, it depends on what you want. Since your language seems to be so low-level, I would highly suggest compiling to machine code. But, either option will work.


@fuzzyastrocat So, you suggest that the link/documentation/article you found would be easier and will still give me what I want: A compiled programming language?


@MocaCDeveloper Yes. In fact, I would not consider a compiled language. It converts the user code to an interpreted virtual machine. I'm not saying it's a bad site, it's a really great tutorial, but it's just not a compiled language per-se (after all, it's called "crafting interpreters"). If you truly want a compiled language, you'll want to generate machine code, which craftinginterpreters does not teach you how to do.


@fuzzyastrocat The link you have given me teaches how to create a compiler for C...I am guessing I am just going to have to carry that knowledge into making my own compiled language?


@MocaCDeveloper Right. It's just like how shows you how to create a virtual machine interpreter for Lox.