2 // The FLEET Assembly Language Grammar
3 // As specified in document 2005-ucies06
6 // comments are included where the grammar had to go beyond the strict
7 // "letter of the law" in ies06
10 // Note that this is the *entire, complete* formal specification of
11 // the grammar. An equivalent lex+yacc grammar and support code would
12 // be several times as long.
15 Comment !::= "//" ~[\n]* "\n"
22 Statement ::= Move ";"? /ws
24 | Port "RENAMES" Port "ENDRENAME" ";" /ws
26 Move ::= Source ^"->" Destination /ws
27 | Destination ^":=" Source /ws
29 Destination ::= Port +/ (ws "," ws)
33 CodeBag ::= CodeBagName? "{" Statement* "}" ";"? /ws
35 // Note: this deviates from ies06
36 location ::= shipname ("." portname)?
37 shipname ::= name index?
38 portname ::= name index?
39 name ::= [A-Za-z] [A-Za-z0-9\[\]\.]*
40 index ::= "[" [0-9]+ "]"
45 // The syntax should be rather self-explanatory; here are some of the
46 // grammatical operators you may not have seen before:
48 // ^ marks the "key" token; this is used only after parsing
49 // / separated-by; all preceding elements are separated by the following element
50 // +/ one-or-more-with-separator; for example, "a"+/"," matches "a,a,a"
51 // */ zero-or-more-with-separator
52 // & intersection; a&b matches a string only if a matches it and b matches it
53 // &~ negated intersection; a&~b matches a string only if a matches it and b DOES NOT match it