Skip to content

Commit

Permalink
readme update
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-artuhov committed May 13, 2021
1 parent 2510a07 commit 680b43f
Showing 1 changed file with 53 additions and 6 deletions.
59 changes: 53 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,59 @@
## Language Grammar
Language Entity | Ruleset
------------ | -------------
expr | (KEYWORD:TYPE)? IDENTIFIER EQ expr
  | term ((PLUS\|MINUS) term)*
term | factor ((MUL\|DIV) factor)*
factor | INT\|FLOAT\|IDENTIFIER
  | (PLUS\|MINUS) factor
  | LPAREN expr RPAREN
statements | expr NEWLINE (expr NEWLINE)*
expr | (KEYWORD:TYPE)? IDENTIFIER EQ expr
  | comp-expr
comp-expr | arith-expr ((AND\|OR\|EQEQ\|NE\|GT\|GTE\|LT\|LTE) arith-expr)*
arith-expr | term ((PLUS\|MINUS) term)*
term | factor ((MUL\|DIV) factor)*
factor | INT\|FLOAT\|IDENTIFIER
  | (PLUS\|MINUS) factor
  | LPAREN comp-expr RPAREN
  | NOT comp-expr
  | if-expr
if-expr | KEYWORD:if LPAREN expr RPAREN LBRACE statements RBRACE
  | (if-else-expr\|else-expr)?
if-else-expr | KEYWORD:elif LPAREN expr RPAREN LBRACE statements RBRACE
  | (if-else-expr\|else-expr)?
else-expr | KEYWORD:otherwise LBRACE statements RBRACE

## Features (pre-release 0.3.0)
- Comparison expressions
- Conditions (with correct scope management)

## Snippets (comparisons, conditions)
Simple comparisons:

```sh
gengo > 1 > 0;
1
gengo > 100 != 99 + 1 - 1;
1
```

Variables included
```sh
gengo > int a = 10; int b = 11;
11 - returns `b` (last statement) as a result of operation
gengo > a <= b;
1
```

Conditions (returns last statement result):
```sh
gengo > int a = 10;
10
gengo > if (a == 10) { a = 11; } elif (a == 11) { a = 12; } otherwise { a = 10; };
11
gengo > if (a == 10) { a = 11; } elif (a == 11) { a = 12; } otherwise { a = 10; };
12
gengo > if (a == 10) { a = 11; } elif (a == 11) { a = 12; } otherwise { a = 10; };
10
gengo > a;
10
```
## Features (pre-release 0.2.0)
- Initializing and using variables
Expand Down

0 comments on commit 680b43f

Please sign in to comment.