-
Notifications
You must be signed in to change notification settings - Fork 0
/
myjs.cf
98 lines (77 loc) · 3.28 KB
/
myjs.cf
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
entrypoints Program ;
Progr. Program ::= [Stmt] ;
[]. [Stmt] ::= ;
(:[]). [Stmt] ::= Stmt;
(:). [Stmt] ::= Stmt [Stmt];
NoIdent. MaybeIdent ::= ;
JustIdent. MaybeIdent ::= Ident;
VarDecl. Decl ::= "var" Ident ";";
VarDeclAssign. Decl ::= "var" Ident "=" Expr ";";
FunDecl. Decl ::= FunExpr;
CS. CompoundStmt ::= "{" [Stmt] "}";
CSS. Stmt ::= CompoundStmt;
ExprStmt. Stmt ::= Expr ";";
DeclStmt. Stmt ::= Decl;
EmptyStmt. Stmt ::= ";";
QIdent. Lvalue ::= [QIdentPart];
IdentPart. QIdentPart ::= IIdent;
(:[]). [QIdentPart] ::= QIdentPart;
(:). [QIdentPart] ::= QIdentPart "." [QIdentPart];
IIdentBare. IIdent ::= Ident;
IIdentIndexed. IIdent ::= Ident "[" Expr "]";
ParamNameList. ParamNames ::= "(" [Ident] ")";
[]. [Ident] ::= ;
(:[]). [Ident] ::= Ident;
(:). [Ident] ::= Ident "," [Ident] ;
ParamList. Params ::= "(" [Param] ")";
ParamExpr. Param ::= Expr;
[]. [Param] ::= ;
(:[]). [Param] ::= Param;
(:). [Param] ::= Param "," [Param] ;
KVP. KeyValuePair ::= Key ":" Expr;
KeyIdent. Key ::= Ident;
KeyString. Key ::= String;
[]. [KeyValuePair] ::= ;
(:[]). [KeyValuePair] ::= KeyValuePair;
(:). [KeyValuePair] ::= KeyValuePair "," [KeyValuePair];
IntLiteral. Literal ::= Integer;
StringLiteral. Literal ::= String;
TrueLiteral. Literal ::= "true";
FalseLiteral. Literal ::= "false";
UndefinedLiteral. Literal ::= "undefined";
ObjectLiteral. Literal ::= "{" [KeyValuePair] "}" ;
ArrayLiteral. Literal ::= "[" [Param] "]";
Fun. FunExpr ::= "function" MaybeIdent ParamNames CompoundStmt;
FunExpression. Expr ::= FunExpr;
AssignExpr. Expr ::= Lvalue "=" Expr;
LOrExpr. Expr2 ::= Expr2 "||" Expr3;
LAndExpr. Expr3 ::= Expr3 "&&" Expr4;
EqExpr. Expr4 ::= Expr4 "===" Expr5;
NeqExpr. Expr4 ::= Expr4 "!==" Expr5;
LessExpr. Expr5 ::= Expr5 "<" Expr6;
GreaterExpr. Expr5 ::= Expr5 ">" Expr6;
LeqExpr. Expr5 ::= Expr5 "<=" Expr6;
GeqExpr. Expr5 ::= Expr5 ">=" Expr6;
PlusExpr. Expr6 ::= Expr6 "+" Expr7;
MinusExpr. Expr6 ::= Expr6 "-" Expr7;
TimesExpr. Expr6 ::= Expr6 "*" Expr7;
DivExpr. Expr6 ::= Expr6 "/" Expr7;
PreincExpr. Expr7 ::= "++" Lvalue;
PredecExpr. Expr7 ::= "--" Lvalue;
PreopExpr. Expr8 ::= UnaryOp Expr9;
ParenExpr. Expr9 ::= "(" Expr ")";
CallExpr. Expr10 ::= Lvalue Params;
LiteralExpr. Expr11 ::= Literal;
EvalExpr. Expr12 ::= Lvalue;
NegOp. UnaryOp ::= "!";
IfStmt. Stmt ::= "if" "(" Expr ")" Stmt ElseClause;
Else. ElseClause ::= "else" Stmt ;
ElseEmpty. ElseClause ::= ;
WhileStmt. Stmt ::= "while" "(" Expr ")" Stmt;
ThrowStmt. Stmt ::= "throw" Expr;
TryCatchStmt. Stmt ::= "try" CompoundStmt "catch" "(" Ident ")" CompoundStmt;
ReturnStmt. Stmt ::= "return" Expr ";";
EmptyReturnStmt. Stmt ::= "return;";
coercions Expr 18 ;
comment "//" ;
comment "/*" "*/" ;