-
Notifications
You must be signed in to change notification settings - Fork 0
/
switch.cfg
61 lines (42 loc) · 1.18 KB
/
switch.cfg
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
S -> Pgm
Pgm -> Statement Pgm | ε
Statement -> Switch | Declaration ; | InitExpr ; | UpdateExpr ; | FnExpr ; | break ;
//Main switch case
Switch -> switch ( Expr ) { caseList defaultOpr caseList}
DefaultOpr -> default : casebody
CaseList -> ε | oneCase CaseList
OneCase -> case constValue : casebody
Casebody -> { Pgm } | Pgm //casebody data
ConstValue -> int | char
//FInal Expression:
FnExp -> console.log ( Value ) ;
//Expression with operator precedence
Expr -> A Expr`
Expr` -> or Expr` | ε
T -> F T`
T` -> and T | ε
F -> G F`
F` -> bitwise_or F | ε
G -> H G`
G` -> bitwise_xor G | ε
H -> I H`
H` -> bitwise_and H | ε
I -> J I`
I` -> EqualityOp I | ε
J -> K J`
J` -> RelOp J | ε
K -> L K`
K` -> BitwiseOp K | ε
L -> M L`
L` -> BasicArthOpr L | ε
M -> N M`
M` -> CmpxArthOpr M | ε
N -> Value | ( Expr )
Value -> id | Literal
Literal -> int | double | boolean | string
//Other operator groups
BasicArthOpr -> + | -
CmpxArthOpr -> * | / | %
BitwiseOp -> << | >>
RelOp -> < | > | >= | <=
EqualityOp -> == | !=