doc: add parser operator priority

This commit is contained in:
Artemy 2023-12-26 13:07:51 +03:00
parent 2f04b070df
commit bb6c67333d
2 changed files with 21 additions and 0 deletions

View file

@ -12,4 +12,6 @@
- [Literals](specification/tokens/kinds/literals.md)
- [Brackets](specification/tokens/kinds/brackets.md)
- [Parser](specification/parser/readme.md)
- [Examples](examples/readme.md)

View file

@ -0,0 +1,19 @@
# Parser
## Expressionss
### Operator priority
| Operator/Expression | Associativity | Parser fn name | Evaluation priority | Implementation |
| --------------------------------------- | ------------- | -------------- | ------------------- | -------------- |
| `!` `++` `--` `()` Literals Identifiers | Left to Right | factor | 1 | ✅ |
| `^` | Left to Left | power | 2 | ✅ |
| `*` `/` `%` | Left to Right | term | 3 | ✅ |
| `+` `-` | Left to Right | add_sub | 4 | ✅ |
| `>>` `<<` | Left to Right | shift | 5 | ❌ |
| `<` `<=` `>` `>=` `==` `!=` | Left to Right | cmp | 6 | ❌ |
| `&` | Left to Right | bit_and | 7 | ❌ |
| <code>\|</code> | Left to Right | bit_or | 8 | ❌ |
| `==` `!=` `<` `<=` `>` `>=` | Left to Right | cmp | 9 | ❌ |
| `&&` | Left to Right | logical_and | 10 | ❌ |
| <code>\|\|</code> | Left to Right | logical_or | 11 | ❌ |