master
Sanjar Ahmadov 3 years ago
parent 1c02aa84d8
commit 0672838265

@ -239,7 +239,7 @@ non terminal Program program;
non terminal List<Declaration> program_head, class_body, class_body_defs, fun_body_decs;
non terminal List<Stmt> stmt_list, opt_stmt_list, block, else_body;
non terminal Stmt stmt, simple_stmt;
non terminal Expr expr, binary_expr, pexpr, cexpr, cmp_pexpr;
non terminal Expr expr, pexpr, cexpr;
non terminal VarDef var_def;
non terminal ClassDef class_def;
non terminal FuncDef fun_def;
@ -376,6 +376,7 @@ else_body ::= ELSE:el COLON block:b {: RES
| {: RESULT = empty(); :}
;
/* simple_stmt */
simple_stmt ::= PASS:p {: RESULT = null; :}
| expr:e {: RESULT = new ExprStmt(exleft, exright, e); :}
@ -417,7 +418,6 @@ cexpr ::= pexpr:pe {: RESULT = pe; :}
;
/* pexpr */
pexpr ::= identifier:id {: RESULT = id; :}
| literal:l {: RESULT = l; :}
@ -456,14 +456,17 @@ comp_op ::= EQUAL:a {: RESULT = new Stri
| IS:a {: RESULT = new StringLiteral(axleft, axright, "is"); :}
;
/* member_expr */
member_expr ::= pexpr:p DOT identifier:id {: RESULT = new MemberExpr(pxleft, idxright, p, id); :}
;
/* index_expr */
index_expr ::= pexpr:p LBR expr:e RBR:rbr {: RESULT = new IndexExpr(pxleft, rbrxright, p, e); :}
;
/* target */
target ::= identifier:id {: RESULT = id; :}
| member_expr:m {: RESULT = m; :}

Loading…
Cancel
Save