-
Notifications
You must be signed in to change notification settings - Fork 0
/
EBNF_POKEBATTLE.txt
57 lines (43 loc) · 1.42 KB
/
EBNF_POKEBATTLE.txt
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
program = { statement } ;
statement = atributes_declaration
| tipo_declaration
| bin_op
| assign
| while_block
| if_block
| func_declaration
| funcall ;
atributes_declaration = VAR_NAME DOUBLE_ARROW ATRIBUTE_INT ASSIGN NUMBER ;
tipo_declaration = VAR_NAME DOUBLE_ARROW ATRIBUTE_STR ASSIGN ASPAS STRING ASPAS ;
bin_op = VAR_NAME BINOP VAR_NAME ;
bool_op = VAR_NAME BOOL_OP NUMBER ;
assign = VAR_NAME ASSIGN bin_op ;
while_block = WHILE bool_op QUEBRA program END ;
if_block = IF bool_op QUEBRA program END ;
func_declaration = FUNC_DEC VAR_NAME OPEN_PAREN func_params CLOSE_PAREN func_return_block END ;
func_params = VAR_NAME SEMI_ARROW VAR_NAME { VIRGULA VAR_NAME SEMI_ARROW VAR_NAME } ;
func_return_block = program RETURN VAR_NAME ;
funcall = VAR_NAME ASSIGN VAR_NAME OPEN_PAREN funcall_params CLOSE_PAREN ;
funcall_params = VAR_NAME { VIRGULA VAR_NAME } ;
VIRGULA ::= , ;
VARNAME ::= [a-zA-Z]+_[a-zA-Z]+ ;
ASSIGN ::= IGUAL ;
ATRIBUTE_INT ::= HP|ATAQUE ;
BOOL_OP ::= MAIOR|MENOR|EXATO ;
IF ::= SE ;
NUMBER ::= \d+ ;
NUMBER ::= digit { digit } ;
digit ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 ;
ATRIBUTE_STR ::= TIPO ;
QUEBRA ::= \n ;
BINOP ::= RECUPERAR|ATACAR|* ;
END ::= FIM_TATICA ;
WHILE ::= BATALHA ;
RETURN ::= RESULTADO ;
ASPAS ::= " ;
OPEN_PAREN ::= ( ;
CLOSE_PAREN ::= ) ;
DOUBLE_ARROW ::= >> ;
SEMI_ARROW ::= => ;
FUNC_DEC ::= ESTRATEGIA ;
STRING ::= [A-Z]+;