Skip to content

Commit 948f128

Browse files
AlexDenisovasl
authored andcommitted
Slightly better wording/formatting
1 parent d90f8be commit 948f128

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

content/posts/2024-12-03-minimalistic-ruby-compiler.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,18 +150,18 @@ A classical compilation pipeline looks as follows:
150150

151151

152152
To build a compiler one needs to implement the conversions from the raw source file all the way down to machine code and the language runtime library.
153-
Since we are targeting the existing runtime, we have the benefit of reusing the frontend (parsing + AST) and the runtime.
153+
Since we are targeting the existing implementation, we have the benefit of reusing the frontend (parsing + AST) and the runtime library.
154154

155155
Still, we need to implement the conversion from AST to the machine code.
156-
And this is where the power of MLIR kicks in: we built a custom dialect ([Rite](https://github.com/DragonRuby/lightstorm/blob/3ed0077af589ba51b98954bba8869daf58e22b9e/include/lightstorm/dialect/rite.td)) which represents mruby VM's bytecode, and then using a number of builtin dialects (`cf`, `func`, `arith`, `emitc`) to convert our IR into C code.
156+
And this is where the power of MLIR kicks in: we built a custom dialect ([Rite](https://github.com/DragonRuby/lightstorm/blob/3ed0077af589ba51b98954bba8869daf58e22b9e/include/lightstorm/dialect/rite.td)) which represents mruby VM's bytecode, and then use a number of builtin dialects (`cf`, `func`, `arith`, `emitc`) to convert our IR into C code.
157157

158158
At this point, we can just use clang to compile/link the code together with the existing runtime and that's it.
159159

160160
The final compilation pipeline looks as follows:
161161

162162
![Lightstorm compilation pipeline](/img/ruby-compiler/lightstorm-compilation-pipeline.png)
163163

164-
With the benefit of MLIR we are able to build a funtional compiler in just a couple of thousands lines of code!
164+
> With the benefit of MLIR we are able to build a funtional compiler in just a couple of thousands lines of code!
165165
166166
Now let's look at how it performs.
167167

0 commit comments

Comments
 (0)