1.1 KiB
1.1 KiB
Grammar of the shulkerscript language
Table of contents
Program
Program: Declaration*;
Declaration
Declaration: FunctionDeclaration;
FunctionDeclaration
Function:
Annotation* 'fn' Identifier '(' ParameterList? ')' Block
;
ParameterList:
Identifier (',' Identifier)* ','?
;
Annotation
Annotation: '#[' Identifier ('=' StringLiteral)? ']';
Statement
Statement:
Block
| LiteralCommand
| Conditional
| Grouping
| DocComment
;
Block
Block: '{' Statement* '}';
Conditional
Conditional:
'if' ParenthizedCondition Block ('else' Block)?
;
ParenthizedCondition
ParenthizedCondition:
'(' Condition ')'
;
Condition
Condition:
StringLiteral
Grouping
Grouping:
'group' Block
;
Expression
Expression:
Primary
Primary
Primary:
FunctionCall
FunctionCall
FunctionCall:
Identifier '(' (Expression (',' Expression)*)? ')'
;