CodeBagDef:: = CodeBagName ":" "{" CodeBagBody "}" /ws
Fiber:: = Pump ":" Instructions /ws
+// FIXME: should not have predicates on clog/unclog/kill/massacre
Instructions:: = Instruction +/ ws
-Instruction = ^"unclog" ";" /ws
+Instruction:: = Predicate InstructionX
+Predicate = "" | ^"[a]" ws | ^"[b]" ws | ^"[z]" ws
+InstructionX = ^"unclog" ";" /ws
| ^"clog" ";" /ws
+ | ^"massacre" ";" /ws
| ^"kill" ";" /ws
+ | "take" ^"loop" "counter" ";" /ws
+ | ^"load" (^"loop"|^"repeat") ws "counter" ";" /ws
+ | "load" (^"loop"|^"repeat") ws "counter" ^"with" int ";" /ws
+ | ^"decrement" "loop" "counter" ";" /ws
+ | ^"setflags" "a" "=" Flags "," "b" "=" Flags ";" /ws
| ^"kill" int ";" /ws
| ^"literal" Literal RequeueCount ";" /ws
| RepeatCount Commands RequeueCount ^";" /ws
RequeueCount = ""
| "," "requeue" (^"forever" | int ws "times") /ws
-// FIXME: ordering constraint on these
+Flags:: = Flag +/ (ws "|" ws)
+Flag = ^"0"
+ | ^"1"
+ | ^"a"
+ | ^"b"
+ | ^"s"
+ | ^"z"
+ | ^"!a"
+ | ^"!b"
+ | ^"!s"
+ | ^"!z"
+
Commands:: = Command +/ (ws "," ws)
Command = ^"wait"
| ^"nop"