3 Def = Id "(" (Id+/comma) "->" (Id+/comma) ")" "=" Exprs /ws
8 ((Expr +/ ws) +/ semicolons)
10 Decl = Id ^"::" ShipName /ws
12 Expr = "{" Exprs "}" /ws
13 | (Literal|Port) ^"-->" Ports /ws
14 | (Literal|Port) ^"+->" Ports /ws
15 | (Literal|Port) ws! ^"-[" Int "]->" ws! Ports
16 | (Literal|Port) ^"-[*]->" Ports /ws
17 | ^"while" Cond Expr /ws
18 // | "if" "then" "else"
20 CondOp = ^"==" | ^"!=" | ^">" | ^">=" | ^"<" | ^"<="
21 Cond = Cond:: Port CondOp Int /ws
23 Ports = ";":: Port +/ semicolon
28 Literal = Int | ^"{" Int +/ comma "}" /ws
30 ShipName = "":: [A-Z] [a-zA-Z0-9_]*
31 Id = "":: [a-z] [a-zA-Z0-9_]*
33 Comment = "//" (~eol)* eol!
34 | "/*" (any* &~ (any*! "*/" any*!)) "*/"
35 ws = (wsc | Comment)* -> ~wsc
37 wsc = [\r\n ] | \{ | \}
39 semicolon = ws! ";" ws!
40 semicolons = ws! ";;" ws!