intellij-pluginjflexgrammar-kit

Can I use only GrammarKit to generate both parser and lexer for Intellij Plugin development (custom lang)


In the tutorial of custom language support for Intellij Plugin development, it uses GrammarKit to generate the Parser and JFlex (patched) to generate the Lexer.

On this page the author says we can "use the GrammarKit plugin to generate lexer and parser".

Is there a particular reason that JetBrains suggest using JFlex to generate the lexer? How different the process would be if we use GrammarKit to generate both?


Solution

  • Well, I think I know the answer now. The short answer is NO. It is a little bit complex than that.

    Grammar-Kit can be used to generate .flex file and you still need JFlex generator to generate the Java lexer.

    Both steps can be done via the context menu.

    See here for more info.