From 030b03c9ed2473205fe5a9b42f2aaa3021fa2c25 Mon Sep 17 00:00:00 2001 From: adam Date: Wed, 11 Jan 2006 22:50:04 -0500 Subject: [PATCH] added fleet.g darcs-hash:20060112035004-5007d-995e9d9dbee3de0d5a3537a8c4b4be072844bb37.gz --- tests/fleet.g | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 tests/fleet.g diff --git a/tests/fleet.g b/tests/fleet.g new file mode 100644 index 0000000..bf136c6 --- /dev/null +++ b/tests/fleet.g @@ -0,0 +1,54 @@ +// +// The FLEET Assembly Language Grammar +// As specified in document 2005-ucies06 +// + +// comments are included where the grammar had to go beyond the strict +// "letter of the law" in ies06 + +// +// Note that this is the *entire, complete* formal specification of +// the grammar. An equivalent lex+yacc grammar and support code would +// be several times as long. +// + +Comment !::= "//" ~[\n]* "\n" + | "/*" ~[\n]* "*/" + +ws ::= w** +w ::= [\r\n ] + | Comment + +Statement ::= Move ";"? /ws + | "{" Statement* "}" + | Port "RENAMES" Port "ENDRENAME" ";" /ws + +Move ::= Source ^"->" Destination /ws + | Destination ^":=" Source /ws + +Destination ::= Port +/ (ws "," ws) +Source ::= Port + | CodeBag + +CodeBag ::= CodeBagName? "{" Statement* "}" ";"? /ws + +// Note: this deviates from ies06 +location ::= shipname ("." portname)? +shipname ::= name index? +portname ::= name index? +name ::= [A-Za-z] [A-Za-z0-9\[\]\.]* +index ::= "[" [0-9]+ "]" + | [0-9]+ + + +// +// 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 +// -- 1.7.10.4