Devlog #7
It’s been a while, hasn’t it. I’ve been busy building a compiler! So I;ve finished the rough draft version, but it took quite a while, leading to the gap in devlogs. The language, Coral, looks like the first image below. The way compiling works is that it first parses the source code into an AST(Abstract Syntax Tree, the code represented as a tree), then converts that to a relatively high level IR (Intermediate Representation), which has similar syntax to the final Assembly, but has infinite virtual registers, and abstracts away having to select specfic instructions for diffrent data types (Unsigned vs Signed, Floats vs Ints, Int32 vs Int16). Then that IR is feed into the backend which translates it into bytecode.
Below is one source example, and its bytecode. From here, I have to implement generic types, defer and error handling and the compiler will be done! Or at least for now. Hopefully my next devlog isn’t in a month.
Log in to leave a comment