JetBrains IntelliJ IDEA plugin which adds BNF (Backus-Naur Form) Grammars and JFlex files editing support including parser/PSI code generator
Questions tagged [grammar-kit]
31 questions
1
vote
1 answer
Is it possible to import another language with grammar-kit?
I am working on a custom language support plugin for Kivy in PyCharm and I think I will need to import some python expressions into it, since .kv files allow some python code in properties definitions and on_properties callbacks definitions.
Is this…

Guga Figueiredo
- 292
- 4
- 18
1
vote
2 answers
How to handle end of file in IntelliJ grammar kit
I'm working on IntelliJ support for a DSL using the Grammar-Kit. I have a rule in the bnf file which requires an EOF (end of file) token at the end:
rule ::= ( object | (( LCURL EOL* properties EOL* RCURL ) | properties ) ) EOL* EOF
I assumed I can…

Michal Pawluk
- 561
- 1
- 5
- 11
1
vote
1 answer
How to solve ambiguity in with keywords as identifiers in grammar kit
I've been trying to write the graphql language grammar for grammarkit and I've found myself really stuck on an ambiguity issue for quite some time now. Keywords in graphql (such as: type, implements, scalar ) can also be names of types or fields.…

Jeff
- 13
- 2
1
vote
1 answer
idea grammar-kit recoverWhile beaks the parser on the first element in list
I have a bnf grammar:
{
tokens = [
COLON = ":"
space=' '
word = 'regexp:[^\r\n\s\t@\$\{\}\(\)\|\#:<>]+'
nl = 'regexp:\r|\n|(\r\n)'
]
}
root ::= nlsp book_keyword COLON [space] book_title sections
book_keyword…

Viktor Sidochenko
- 361
- 3
- 17
1
vote
1 answer
How to generate autocompletion via grammar structure?
I configured the grammar of a structured language and now want to code the autocompletion behaviour. Is there a way to generate that based on the grammar which is defined like this?
RootObject ::= ROOT ( NameAttr | TitleAttr )* END
private NameAttr…

dnltsk
- 1,037
- 1
- 8
- 9
1
vote
1 answer
How does one change the path that Grammar-Kit's generated lexer Java file is generated into?
How do I change the path that Grammar-Kit's generated JFlex lexer Java file is generated into?
I've asked on Grammar-Kit's issue tracker, but haven't received any response.
I'm tired of of the lexer not being put into my generated files directory…

naki
- 932
- 6
- 11
1
vote
1 answer
How to compose BNF rules using Grammar-Kit
I am trying to convert an EBNF file into working BNF for IntelliJ Grammar-kit.
In the EBNF there are rules as such:
BinOpChar ::= "~" | "!" | "@" | "#" | "$" | "%" | "^" | "&" | "*" | "-"
BinOp ::= BinOpChar, {BinOpChar}
How can I create such rules…

Johnny Everson
- 8,343
- 7
- 39
- 75
1
vote
1 answer
How to express a lowercase followed by any case char using BNF?
I am trying to learn how IntelliJ Grammar Kit works for creating a BNF
How can I define an identifier that stars with 'v' and then have any case. e.g. 'vModule'.
Here is my attempt:
identifier ::= "v"id
But then, instead of 'vModule', it expects 'v…

Johnny Everson
- 8,343
- 7
- 39
- 75
1
vote
0 answers
Parsing Elm case expression clashes with function call
I am developing an Intellij plugin for the Elm language using JFlex and Grammar Kit. I have minimal experience writing parsers.
I can't parse case expressions because they clash with function calls.
The BNF spec is as follows:
expr ::=
NUM
|…

mikemay
- 3,707
- 6
- 34
- 35
1
vote
1 answer
Does something like an ASTNode Identifier exist in IntelliJ
I am writing a Plugin for IntelliJ Idea and now I need something like an ASTNode Identifier, it must be unique for every single Node in the AST.
What should I use?

user2988098
- 81
- 1
- 6
0
votes
0 answers
No compileOnly configuration in the build.gradle but it is
I have the following error message during the build, but no compileOnly dependency in my build.gradle. Why it's happens, and how to solve?
Regards
Resolving dependency configuration 'compileOnly' is not allowed as it
is defined as…

Vladimir Kozhaev
- 77
- 8
0
votes
1 answer
How to make a simple calculator syntax highlighting for IntelliJ?
I'm making a custom language support plugin according to this tutorial and I'm stuck with a few .bnf concepts. Let's say I want to parse a simple calculator language that supports +,-,*,/,unary -, and parentheses. Here's what I currently…

Poma
- 8,174
- 18
- 82
- 144
0
votes
1 answer
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…

Devs love ZenUML
- 11,344
- 8
- 53
- 67
0
votes
1 answer
Unbalanced tree. Most probably caused by unbalanced markers
I'm working on an IntelliJ plugin which will add support for a custom language. Currently, I'm still just trying to get used to grammar kit and how plugin development works.
To that end, I've started working on a parser for basic expressions:
(1.0…

Mike Fougere
- 157
- 1
- 6
0
votes
1 answer
How to define structured data types in Grammar-Kit?
I want to define a Domain Specific Language (DSL) that is structures / cascaded like this
ROOT
NAME "my dsl"
TODO
DESC "foo"
END
TODO
DESC "bar"
END
END
For my understanding it needs the following rules:
ROOT and TODO objects has…

dnltsk
- 1,037
- 1
- 8
- 9