<@U01CJJCG8H2> <@UKPEELJCW> TL; DR: I am two steps...
# compiler
v
@Abel @dmitriy.novozhilov TL; DR: I am two steps closer to make kotlin compiler generate code to another virtual machine
@Piotr Krzemiński did an amazing work trying to create Python compiler based on
kotlinc-js
Looking at Crash course on the Kotlin compiler, I found a nice documentation about the frontend
The insane part which is learn each Java opcode instruction such as
Opcodes.POP2
or
0x58
) and find it correspondent in the other ASM grammar is 80% complete
So, in the backend side, I would have to create a new AST translator/visitor that produce new ASM code (so far, so good)
Now the part I am complete lost because most of my knowledge is still based on Kotlin 1.x.x
How IntelliJ or Android Studio is capable of import a Java library and generate code to intellisense that is comprehensible to the Kotlin code? Is it a function provided by the frontend or some Gradle pluging integrated into the IDEs?
Originally I started my master degree in compiler, so a lot of my knowledge is based on Appel, Aho, and Muchnick
So instead of doing a top-down approach like @Piotr Krzemiński, I would like to know if it is possible to create a really dummy bottom-up example capable or manipulate only arithmetic operations (like
kotlinc
REPL does)
Thus, instead of reverse engineer
backend.common.jvm
, would it be possible create the AST incrementally similarly like Appel Mini Java Grammar?
@Abel @dmitriy.novozhilov It took me two years, but here is a partial mapping of JVM opcodes to CIL instructions
README.md
Creating an MVP only capable of doing arithmetic operations such as
Copy code
val a = 1
val b = 2
val c = a + b
print(c)
would be a rocket lunch to me right now
u
• Please do not ping or mention someone directly to get your questions answered, specially project owners, whether the project is Kotlin or other, unless they specifically indicate that you can.
https://kotlinlang.org/community/slackccugl.html#basic-usage-guidelines
v
@udalov sorry
I just pinged you because you answer my question about it 2 years ago
a
Big up on your endeavor
h
Isn’t the code generator only one part for whole support? What about the native runtime?