How does the compiler work?


#1

Hi everyone,

I am currently trying to write an IntelliJ plugin for the Ceylon programming language, and a few difficulties are coming my way, mainly because the original parser and type checker use ANTLR, which is not kwown to be friends with the way IntelliJ works. So I decided to take a look at how it works in Kotlin, since it should be a state-of-the-art plugin.

A quick glance seems to show that the compiler and the plugin share some code, especially related to errors detection. Could someone please confirm that:

  • the compiler and the plugin both use the same parser and PSI elements?
  • the compiler is heavily based on classes from IntelliJ’s codebase, which are thus included in the standalone compiler distribution (kotlinc/lib/compiler/org/jetbrains/jet/internal)?

Other question: how do you plan to develop the Eclipse plugin? Will it also rely on the same parser/highlighters, with a bridge to translate PsiElements to their equivalent in the Eclipse platform (I don’t really know how it works)?

Back to my Ceylon plugin, I’m afraid it won’t be as easy as for Kotlin, which was thought from the beginning to be compatible with IntelliJ. Do you think there is another solution than reimplementing a whole parser + HighlightVisitors?

Thanks for yout answers and keep up the good work :slight_smile:

Bastien