-
Notifications
You must be signed in to change notification settings - Fork 1
/
minic.gram
81 lines (59 loc) · 1.39 KB
/
minic.gram
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
PROG -> DECL_VAR CONST FUNCOES MAIN
DECL_VAR -> TIPO id ; DECL_VAR
DECL_VAR ->
CONST -> const TIPO id = num ; CONST
CONST ->
FUNCOES -> FUNCAO FUNCOES
FUNCOES ->
FUNCAO -> TIPO id ( ) { DECL_VAR CMDS return id ; }
MAIN -> main { DECL_VAR CMDS }
TIPO -> int
TIPO -> float
TIPO -> char
TIPO -> string
CMDS -> CMD CMDS
CMDS -> CMD
CMD -> IF
CMD -> WHILE
CMD -> FOR
CMD -> ATR
CMD -> INCR ;
CMD -> CH_FUNC
IF -> if ( TESTE ) { CMDS }
IF -> if ( TESTE ) { CMDS } else { CMDS }
WHILE -> while ( TESTE ) { CMDS }
FOR -> for ( ATR_FOR ; TESTE ; INCR ) { CMDS }
ATR -> id = num ;
ATR -> id = EXPR_MAT ;
ATR -> id = ch ;
ATR -> id = string ;
ATR -> id = CH_FUNC ;
ATR -> id = id ;
CH_FUNC -> id ( ) ;
INCR -> id ++
INCR -> id --
ATR_FOR -> id = num
EXPR_MAT -> num OP_ARIT num
EXPR_MAT -> id OP_ARIT id
EXPR_MAT -> id OP_ARIT num
EXPR_MAT -> num OP_ARIT id
TESTE -> EXPR_REL
TESTE -> EXPR_REL OP_LOG TESTE
EXPR_REL -> id OP_REL id
EXPR_REL -> id OP_REL num
EXPR_REL -> num OP_REL id
EXPR_REL -> num OP_REL num
OP_REL -> ==
OP_REL -> >
OP_REL -> <
OP_REL -> >=
OP_REL -> <=
OP_REL -> !=
OP_LOG -> &&
OP_LOG -> ||
OP_ARIT -> +
OP_ARIT -> -
OP_ARIT -> *
OP_ARIT -> /
OP_ARIT -> #
OP_ARIT -> %