2023-01-05 23:20:58 +00:00
|
|
|
# Grammar
|
|
|
|
|
|
|
|
## Module
|
|
|
|
|
|
|
|
A module is (commonly) a single source file.
|
|
|
|
|
|
|
|
- `module = variable_binding*`
|
|
|
|
|
|
|
|
|
|
|
|
### `variable_binding`
|
|
|
|
|
|
|
|
A declaration with `var` or `val`.
|
|
|
|
|
2023-02-15 21:17:50 +00:00
|
|
|
```ebnf
|
|
|
|
var = "var"
|
|
|
|
val = "val"
|
|
|
|
variable_binding = (var | val), identifier, "=", expression
|
|
|
|
```
|
|
|
|
|
2023-01-05 23:20:58 +00:00
|
|
|
|
|
|
|
### `expression`
|
|
|
|
|
2023-02-15 21:17:50 +00:00
|
|
|
For now just a number, string or boolean
|
|
|
|
|
|
|
|
```ebnf
|
|
|
|
expression = number | string | boolean
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Type annotations
|
2023-01-05 23:20:58 +00:00
|
|
|
|
2023-02-15 21:17:50 +00:00
|
|
|
```ebnf
|
|
|
|
variable_binding = Datatype, (var | val), identifier, "=", expression
|
|
|
|
```
|
2023-01-05 23:20:58 +00:00
|
|
|
|