Program = Program:: Directive+/ws
| Program:: (Directive+/ws) ws! CodeBagBody
-Statement = Fiber:: Source ":" (Instruction +/ ws) /ws
- | Literal:: int ":" "sendto" Port ";" /ws
- | NamedCodeBag:: name ":" "{" CodeBagBody "}" /ws
+Statement = Fiber:: Source ":" (Instruction +/ ws) /ws
+ | Literal:: int ":" "sendto" Port ";" /ws
+ | ShipSpecificLiteral:: SSL ":" "sendto" Port ";" /ws
+ | CodeBagDescriptor:: CodeBag ":" "sendto" Port ";" /ws
+ | NamedCodeBag:: name ":" "{" CodeBagBody "}" /ws
+CountField = Brack:: "[" int "]"
+ | Paren:: "(" int ")"
+ | BrackStar:: "[*]"
+ | ParenStar:: "(*)"
Instruction = Instruction::
- (Brack:: "[" (int|(Star::"*"))? ("r")? "]" ws!)?
+ (CountField ws!)?
(Command +/ (ws! "," ws!) ws! ";"!)
-Command = Nop:: "nop"
- | Kill:: "kill"
- | Wait:: "wait"
- | Discard:: "discard"
- | Take:: "take"
- | SendTo:: "sendto" ws! Port
- | Deliver:: "deliver"
- | Ack:: "ack" ws! Port
+Command = Nop:: "nop"
+ | Kill:: "kill"
+ | KillStar:: "kill*"
+ | Wait:: "wait"
+ | Discard:: "dismiss"
+ | Take:: ("take"|"receive")
+ | SendTo:: "sendto" ws! Port
+ | Deliver:: "deliver"
+ | Ack:: "notify" ws! Port
Source = Port
- | CodeBag
| ShipSpecific
+SSL = ShipSpecificLiteral:: shiptype "." ShipSpecificLiteral
Port = Port:: shipname "." portname
| ^"()"
CodeBag = CodeBagRef:: CodeBagName
| AnonymousCodeBag:: "{" CodeBagBody "}" /ws
-CodeBagName = name
-shipname = name
-portname = name
-name = Name:: [A-Za-z] [A-Za-z0-9\[\]_]**
-index = "[" [0-9]+ "]" | [0-9]+
-int = [\-0-9]++
-ShipSpecific = ShipSpecific:: "\"" ~[\"]++ "\""
+CodeBagName = name
+shipname = name
+shiptype = Name:: [A-Z] [A-Za-z0-9\[\]_]**
+ShipSpecificLiteral = Name:: [A-Z] [A-Z0-9\[\]_]**
+portname = Name:: [a-z] [A-Za-z0-9\[\]_]**
+name = Name:: [A-Za-z] [A-Za-z0-9\[\]_]**
+index = "[" [0-9]+ "]" | [0-9]+
+int = [\-0-9]++
+ShipSpecific = ShipSpecific:: "\"" ~[\"]++ "\""
// the following are not part of the official FLEET syntax and are
// specific to Adam's interpreter.
| Import:: "#import" [A-Za-z_.]++ /ws
| Include:: "#include" ("\"" (~[\"])+ "\"") /ws
| Ship:: "#ship" shipname ":" [0-9A-Za-z_.]++ /ws
+ | Expect:: "#expect" int /ws