The website uses cookies to optimize your user experience. Using this website grants us the permission to collect certain information essential to the provision of our services to you, but you may change the cookie settings within your browser any time you wish. Learn more
I agree
Text direction?


This section informally explains the grammar notation used below.

Symbols and naming

Terminal symbol names start with an uppercase letter, e.g. SimpleName.
Nonterminal symbol names start with a lowercase letter, e.g. kotlinFile.
Each production starts with a colon (:).
Symbol definitions may have many productions and are terminated by a semicolon (;).
Symbol definitions may be prepended with attributes, e.g. start attribute denotes a start symbol.

EBNF expressions

Operator | denotes alternative.
Operator * denotes iteration (zero or more).
Operator + denotes iteration (one or more).
Operator ? denotes option (zero or one).
alpha{beta} denotes a nonempty beta-separated list of alpha's.
Operator ++ means that no space or comment is allowed between operands.


Kotlin provides "semicolon inference": syntactically, subsentences (e.g., statements, declarations etc) are separated by the pseudo-token SEMI, which stands for "semicolon or newline". In most cases, there's no need for semicolons in Kotlin code.

Related Notes
Get a free MyMarkup account to save this article and view it later on any device.
Create account

End User License Agreement

Summary | 1 Annotations
2017/09/16 16:10