Attila's Blog

About writing your own programming language in C, Go and Swift

Compiler basics

Jan 2, 2019 Comments

Categories: aspl
Tags: compiler

Well, I am back from a long vacation, ready to continue from where we stopped back in October. As a recap, we learned how to store bytecode along with its constants. All this time we wrote bytecode by hand because we did not have any means to generate it for us. This is going to change now.

Today we start implementing the basics of the compiler, and by the end of this post, we will be able to compile the four basic arithmetic expressions into bytecode. Exciting, isn’t it? Let’s jump into it.

Bytecode constants

Oct 29, 2018 Comments

Categories: aspl

Last time, we discussed how we store our bytecode. Our current bytecode storage is somewhat limited, though. We are not yet able to use operands for our operations. It is time to fix this problem.

Bytecode arrays

Oct 8, 2018 Comments

Categories: aspl

Last time we discussed what bytecode is and why we want to use it. Now it is time to learn how to store it effectively, so our future virtual machine will be able to execute it fast.