-//
-// The syntax should be rather self-explanatory; here are some of the
-// grammatical operators you may not have seen before:
-//
-// ^ marks the "key" token; this is used only after parsing
-// / separated-by; all preceding elements are separated by the following element
-// +/ one-or-more-with-separator; for example, "a"+/"," matches "a,a,a"
-// */ zero-or-more-with-separator
-// & intersection; a&b matches a string only if a matches it and b matches it
-// &~ negated intersection; a&~b matches a string only if a matches it and b DOES NOT match it
-//
+CodeBag = CodeBag::
+ name:(name !ws ":" !ws)?
+ "{"
+ !ws statements:(Statement +/ ws) !ws
+ "}"
+ (!ws ";")?
+
+Port = Port:: shipname ("." portname)*
+shipname = ShipName:: name index?
+portname = PortName:: name index?
+name = [A-Za-z0-9\[\]\.]**
+index = "[" [0-9]+ "]"
+ | [0-9]+