fleet grammar updates
authoradam <adam@megacz.com>
Mon, 9 Oct 2006 03:23:32 +0000 (23:23 -0400)
committeradam <adam@megacz.com>
Mon, 9 Oct 2006 03:23:32 +0000 (23:23 -0400)
darcs-hash:20061009032332-5007d-ec3ca53847ba32c0eb7b9997a51f45240bfa55a1.gz

tests/fleet.g
tests/regression.tc
tests/test.fleet

index 3f70ddf..965a712 100644 (file)
@@ -14,31 +14,42 @@ Comment        = "//" ~[\n]* "\n"
 w             = [\r\n ]*
 ws            = (w | Comment)* -> ~[\r\n ]
 
-s              = !ws Program !ws
-Program        = CodeBag:: statements:(Statement +/ ws)
+s              = ws! Program ws!
+Program        = Program::
+                    (Directive ws!)*
+                    CodeBagBody
 
-Statement      = Move !((ws ";")?)
+Directive      = Memory::  "#memory" "{" (int +/ (ws! "," ws!)) "}" /ws
+               | Import::  "#import" [A-Za-z_.]++ /ws
+               | Ship::    "#ship" shipname ":" [A-Za-z_\.]++ /ws
+
+
+Statement      = Move ((ws ";")?)!
                | CodeBag
-               | ^"#define" Port Port                  /ws
+//             | ^"#define" Port Port                  /ws
 
 Move           = Source       ^"->"  Destination        /ws
                | Source       ^"->*" Destination        /ws
                | Port         ^":="  Source             /ws
 
-Destination    = Port +/ (!ws "," !ws)
+Destination    = Port +/ (ws! "," ws!)
 Source         = Port
                | CodeBag
-
-CodeBag        = CodeBag::
-                     name:(name !ws ":" !ws)?
+CodeBagBody    = CodeBag:: (Statement +/ ws)
+CodeBag        = NamedCodeBag::
+                     name:(name ws! ":" ws!)?
                      "{"
-                           !ws statements:(Statement +/ 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\[\]\.]**
+                     (ws! ";")?!
+
+//Port           = Port::     shipname ("." portname)*
+Port           = Port::     shipname "." portname
+               | Port::     shipname
+shipname       = ShipName:: name (index?)
+portname       = PortName:: name (index?)
+name           = [A-Za-z0-9\[\]]**
 index          = "[" [0-9]+ "]"
                | [0-9]+
+int            = [0-9]++
+
index fba2786..9312733 100644 (file)
@@ -408,3 +408,4 @@ testcase {
   WSB = () -> ~" "
       | WSB:: " "++
 }
+
index 744a0d6..20de475 100644 (file)
@@ -1,8 +1,17 @@
 
-// this is a test
+#import edu.berkeley.fleet
 
-  bob: { z -> q }
-  bob -> mary
-  mary := bob
+#ship adder : AdderShip
+#ship memread : MemReadShip
+#ship memwrite : MemWriteShip
+#ship one : OneProducerShip
+#ship halt : HaltShip
 
-  a -> foo, /* charles, */ baz
+#memory { 000, 100, 200, 300, 400, 500 }
+
+one.out      -> adder.in1
+one.out      -> adder.in2
+adder.out    -> memread.addr
+memread.data -> adder.in1
+one.out      -> adder.in2
+adder.out    -> halt.in