-
Notifications
You must be signed in to change notification settings - Fork 0
/
syntaxe.bnf
34 lines (28 loc) · 1.43 KB
/
syntaxe.bnf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<variable> ::= "A" | "B" | "C" | "D" | "E" | "F" | "G"
| "H" | "I" | "J" | "K" | "L" | "M" | "N"
| "O" | "P" | "Q" | "R" | "S" | "T" | "U"
| "V" | "W" | "X" | "Y" | "Z"
<digit> ::= "0" | "1" | "2" | "3" | "4"
| "5" | "6" | "7" | "8" | "9"
<integer> ::= <digit>
| <digit> <constant>
<arithm> ::= <integer> ; non-negative integer
| <variable>
| <arithm> <arithm> "+" ; addition
| <arithm> <arithm> "-" ; substraction
| <arithm> <arithm> "*" ; multiplication
<condition> ::= "TRUE"
| "FALSE"
| "[" <arithm> "] == [" <arithm> "]"
| "[" <arithm> "] <= [" <arithm> "]"
| "(" <arithm> ") AND (" <arithm> ")"
| "(" <arithm> ") OR (" <arithm> ")"
| "NOT (" <condition> ")"
<instruction> ::= "#" <comment> ; comment
| <variable> " ::= [" <arithm> "];" ; assignment
| "if " <condition> " then {" <code_block> "} else {" <code_block> "}";
| "while " <condition> "{" <code_block> "};"
| "print [" <arithm> "];"
| " " <instruction> ; support for tabulation
<code_block> ::= <instruction>
| <code_block> <instruction>