what's the most updated resource for someone appro...
# compiler
e
what's the most updated resource for someone approaching writing a compiler plugin for the first time? I saw the

famous video

from Kevin Most at KotlinConf '18 Then I saw this blog entry, and this with Arrow Meta.. or I could go completely in my own trying to modify and existing plugin what would you suggest me to follow?
p
If it fits your need, KSP is the way to go https://github.com/google/ksp
e
I've been already using it for code generation, but now I'd like to try code source modification (appending)
this seems what I was looking for
h
If you really just want to append code, you can still use
KSP
and generate extension functions.
2
a
Do you want to generate code at the IR generation level? You can find several examples in our plugin
You also can ask me about some details
e
i honestly don't know, I'd just like to modify existing source appending new code
a
Would you like to make it a multiplatform approach or only to one target? I mean, you can generate IR and it will work for JVM, Native and JS. But you can generate JVM bytecode and it will available only for JVM
e
no, just jvm
a
We have an old version when we generated bytecode instead of IR
e
is IR only aimed exclusively at multiplatform?
a
yes, by my knowledge bytecode generation extensions will be kept and you can use it
e
isn't there any other advantages of using that? Like, I don't know, easier to use or something similar?
a
I am not sure it is easier to use... I mean, both of these two approaches are almost similar - you create an extension and generate IR or bytecode in the same places. The main difference is you have to generate IR in the first case and JVM bytecode in the second one. Maybe generation of JVM bytecode currently is easier since a lot of plugins to view bytecode and so on are exist, and for IR you will probably not find a lot of information. But on the IR level, you have a more general representation of the code and it is easier.
👍 1
e
what's that?