thp/src/syntax/grammar.md

36 lines
476 B
Markdown
Raw Normal View History

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`.
```ebnf
var = "var"
val = "val"
variable_binding = (var | val), identifier, "=", expression
```
2023-01-05 23:20:58 +00:00
### `expression`
For now just a number, string or boolean
```ebnf
expression = number | string | boolean
```
## Type annotations
2023-01-05 23:20:58 +00:00
```ebnf
variable_binding = Datatype, (var | val), identifier, "=", expression
```
2023-01-05 23:20:58 +00:00