feat: add docs
This commit is contained in:
parent
85a530ea1b
commit
21db990ba4
BIN
public/img/desc_thp_2.jpg
Normal file
BIN
public/img/desc_thp_2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
@ -13,7 +13,7 @@ Welcome to the documentation of the THP programming languague.
|
||||
|
||||
THP ~~is~~ will be a new programming language that compiles to PHP.
|
||||
|
||||
![Accurate visual description of THP](/img/desc_thp.jpg)
|
||||
![Accurate visual description of THP](/img/desc_thp_2.jpg)
|
||||
|
||||
## Compiler rewrite
|
||||
|
||||
|
@ -322,6 +322,23 @@ RightBrace = "}"
|
||||
On this section of the grammar plain strings are used instead of
|
||||
keywords productions.
|
||||
|
||||
### Source file & modules
|
||||
|
||||
Each THP source file is a module.
|
||||
|
||||
```ebnf
|
||||
Module = Statement*
|
||||
```
|
||||
|
||||
### Statement
|
||||
|
||||
For now there is only 1 type of statement.
|
||||
|
||||
```ebnf
|
||||
Statement = VariableBinding
|
||||
```
|
||||
|
||||
|
||||
### Variable binding
|
||||
|
||||
Variable bindings have 2 forms: immutable & mutable.
|
||||
@ -337,6 +354,8 @@ can be dropped. Mutable bindings cannot drop the var keyword.
|
||||
|
||||
|
||||
```ebnf
|
||||
VariableBinding = ImmutableBinding | MutableBinding
|
||||
|
||||
ImmutableBinding = "val", Datatype?, Identifier, "=", Expression
|
||||
| Datatype, Identifier, "=", Expression
|
||||
|
||||
@ -345,6 +364,11 @@ MutableBinding = "var", Datatype?, Identifier, "=", Expression
|
||||
|
||||
### Expression
|
||||
|
||||
For now, the only expression recognized is a number.
|
||||
|
||||
```ebnf
|
||||
Expression = Number
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user