shulkerscript-lang/grammar.md

62 lines
817 B
Markdown
Raw Normal View History

# Grammar of the shulkerscript language
## Table of contents
### Program
```ebnf
Program: Declaration*;
```
### Declaration
```ebnf
Declaration: FunctionDeclaration;
```
### FunctionDeclaration
```ebnf
Function:
2024-04-01 20:42:38 +02:00
Annotation* 'fn' Identifier '(' ParameterList? ')' Block
;
ParameterList:
Identifier (',' Identifier)* ','?
;
```
2024-04-01 20:42:38 +02:00
### Annotation
```ebnf
Annotation: '#[' Identifier ('=' StringLiteral)? ']';
```
### Statement
```ebnf
Statement:
Block
| LiteralCommand
| Conditional
;
```
### Block
```ebnf
Block: '{' Statement* '}';
```
### Conditional
```ebnf
Conditional:
'if' ParenthizedCondition Block ('else' Block)?
;
```
### ParenthizedCondition
```ebnf
ParenthizedCondition:
'(' Condition ')'
;
```
### Condition
```ebnf
Condition:
StringLiteral
```