SHARE
TWEET

Untitled

tinyevil May 25th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. expr ::= expr[12]
  4.  
  5. expr_at[n] | n > 0 ::= expr_at[n - 1]
  6. expr_at[12]        ::= expr_at[12]!lhs || expr_at[11]!rhs {new BinOpExpr(BinOp::And, lhs, rhs)}
  7. expr_at[11]        ::= expr_at[11]!lhs && expr_at[10]!rhs {new BinOpExpr(BinOp::Or, lhs, rhs)}
  8. expr_at[10]        ::= expr_at[9]!lhs < expr_at[9]!rhs    {new BinOpExpr(BinOp::LT, lhs, rhs)}
  9. expr_at[10]        ::= expr_at[9]!lhs > expr_at[9]!rhs    {new BinOpExpr(BinOp::GT, lhs, rhs)}
  10. expr_at[10]        ::= expr_at[9]!lhs <= expr_at[9]!rhs   {new BinOpExpr(BinOp::LE, lhs, rhs)}
  11. expr_at[10]        ::= expr_at[9]!lhs >= expr_at[9]!rhs   {new BinOpExpr(BinOp::GE, lhs, rhs)}
  12. expr_at[10]        ::= expr_at[9]!lhs != expr_at[9]!rhs   {new BinOpExpr(BinOp::NEQ, lhs, rhs)}
  13. expr_at[10]        ::= expr_at[9]!lhs == expr_at[9]!rhs   {new BinOpExpr(BinOp::EQ, lhs, rhs)}
  14. expr_at[9]         ::= expr_at[9]!lhs + expr_at[8]!rhs    {new BinOpExpr(BinOp::Add, lhs, rhs)}
  15. expr_at[9]         ::= expr_at[9]!lhs - expr_at[8]!rhs    {new BinOpExpr(BinOp::Sub, lhs, rhs)}
  16. expr_at[8]         ::= expr_at[8]!lhs * expr_at[7]!rhs    {new BinOpExpr(BinOp::Sub, lhs, rhs)}
  17. expr_at[8]         ::= expr_at[8]!lhs / expr_at[7]!rhs    {new BinOpExpr(BinOp::Sub, lhs, rhs)}
  18. expr_at[6]         ::= expr_at[6]!head ( expr_list! )     {new CallExpr(head, expr_list)}
  19. expr_at[2]         ::= expr_at[2]!lhs . id!               {new FieldExpr(lhs, id)}
  20. expr_at[0]         ::= prim!
  21.  
  22. expr_list ::= {nullptr}
  23. expr_list ::= expr! expr_list_tail!tail {new ExprList(expr, tail)}
  24. expr_list_tail ::= {nullptr}
  25. expr_list_tail ::= , expr! expr_list_tail!tail {new ExprList(expr, tail)}
  26.  
  27. prim ::= num! {new NumLit(num)}
  28. prim ::= id!  {new IdExpr(id)}
  29. prim ::= ( expr! )
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top