Skip to content

Instantly share code, notes, and snippets.

@ehuss

ehuss/foo.lyg Secret

Created February 6, 2019 04:15
Show Gist options
  • Save ehuss/dcbde9df0157feda44b4e40774ac81a6 to your computer and use it in GitHub Desktop.
Save ehuss/dcbde9df0157feda44b4e40774ac81a6 to your computer and use it in GitHub Desktop.
Expr =
| Literal:LITERAL
| Paren:{ "(" expr:Expr ")" }
| Borrow:{ "&" mutable:"mut"? expr:Expr }
| Box:{ "box" expr:Expr }
| Try:{ expr:Expr "?" }
| Range:{ start:Expr? ".." end:Expr? }
| RangeInclusive:{ start:Expr? "..=" end:Expr }
| Cast:{ expr:Expr "as" ty:IDENT }
| Index:{ base:Expr "[" index:Expr "]" }
| Array:{ "[" exprs:Expr* % "," ","? "]" }
| Repeat:{ "[" elem:Expr ";" count:Expr "]" }
| Tuple:{ "(" exprs:Expr* % "," ","? ")" }
| Call:{ callee:Expr "(" args:Expr* % "," ","? ")" }
| MethodCall:{ receiver:Expr "." method:IDENT "(" args:Expr* % "," ","? ")" }
| Continue:{ "continue" }
| Break:{ "break" value:Expr? }
| Return:{ "return" value:Expr? }
;
ModuleContents = items:Expr*;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment