From: adam Date: Thu, 30 Mar 2006 15:13:55 +0000 (-0500) Subject: checkpoint X-Git-Tag: tag_for_25-Mar~274 X-Git-Url: http://git.megacz.com/?p=sbp.git;a=commitdiff_plain;h=944848ba21df8673ba812a764fc641d7fbaea54c checkpoint darcs-hash:20060330151355-5007d-d6aa47b5567ff0a5790574a24a96ff8c5ebe7917.gz --- diff --git a/Makefile b/Makefile index c2dd714..f61196e 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ java = java -doc: edu.berkeley.sbp.jar +tibdoc: edu.berkeley.sbp.jar $(java) -cp $< edu.berkeley.sbp.tib.TibDoc \ tests/tibdoc.g \ tests/input.tibdoc diff --git a/src/edu/berkeley/sbp/GSS.java b/src/edu/berkeley/sbp/GSS.java index 1d91f89..5690c07 100644 --- a/src/edu/berkeley/sbp/GSS.java +++ b/src/edu/berkeley/sbp/GSS.java @@ -25,7 +25,7 @@ class GSS { public Forest.Ref finalResult; /** corresponds to a positions between tokens the input stream; same as Tomita's U_i's */ - public class Phase implements Invokable.Node>, IntegerMappable { + class Phase implements Invokable.Node>, IntegerMappable { public void invoke(State st, Forest result, Node n) { good |= next.newNode(n, result, st, false); diff --git a/src/edu/berkeley/sbp/misc/MetaGrammar.java b/src/edu/berkeley/sbp/misc/MetaGrammar.java index c96d2ff..378a53c 100644 --- a/src/edu/berkeley/sbp/misc/MetaGrammar.java +++ b/src/edu/berkeley/sbp/misc/MetaGrammar.java @@ -504,6 +504,12 @@ public class MetaGrammar extends StringWalker { + + + + + + // DO NOT EDIT STUFF BELOW: IT IS AUTOMATICALLY GENERATED new edu.berkeley.sbp.Tree(null, "grammar", new edu.berkeley.sbp.Tree[] { new edu.berkeley.sbp.Tree(null, null, new edu.berkeley.sbp.Tree[] { new edu.berkeley.sbp.Tree(null, "=", new edu.berkeley.sbp.Tree[] { new edu.berkeley.sbp.Tree(null, null, new edu.berkeley.sbp.Tree[] { new edu.berkeley.sbp.Tree(null, "s", new edu.berkeley.sbp.Tree[] { })}), new edu.berkeley.sbp.Tree(null, null, new edu.berkeley.sbp.Tree[] { new edu.berkeley.sbp.Tree(null, null, new edu.berkeley.sbp.Tree[] { new edu.berkeley.sbp.Tree(null, "psx", new edu.berkeley.sbp.Tree[] { new edu.berkeley.sbp.Tree(null, "ps", new edu.berkeley.sbp.Tree[] { new edu.berkeley.sbp.Tree(null, null, new edu.berkeley.sbp.Tree[] { new edu.berkeley.sbp.Tree(null, "!", new edu.berkeley.sbp.Tree[] { new edu.berkeley.sbp.Tree(null, "nonTerminal", new edu.berkeley.sbp.Tree[] { new edu.berkeley.sbp.Tree(null, null, new edu.berkeley.sbp.Tree[] { new edu.berkeley.sbp.Tree(null, "w", new edu.berkeley.sbp.Tree[] { }), @@ -1158,3 +1164,9 @@ new edu.berkeley.sbp.Tree(null, "grammar", new edu.berkeley.sbp.Tree[] { new edu + + + + + + diff --git a/src/edu/berkeley/sbp/tib/TibDoc.java b/src/edu/berkeley/sbp/tib/TibDoc.java index 4dccac8..b8a4c48 100644 --- a/src/edu/berkeley/sbp/tib/TibDoc.java +++ b/src/edu/berkeley/sbp/tib/TibDoc.java @@ -103,9 +103,9 @@ public class TibDoc { public static class Today extends Text { } public static class Euro extends Text { public void toHTML(ToHTML.HTML sb) { sb.entity(8364); } } public static class Link extends Text { - public Object word; + public Text[] text; public URI href; - public void toHTML(ToHTML.HTML sb) { sb.tag("a", new Object[] { "href", href }, word); } + public void toHTML(ToHTML.HTML sb) { sb.tag("a", new Object[] { "href", href }, text); } } public static class Entity extends Text { public final String entity; diff --git a/tests/ArchSimA3.jar b/tests/ArchSimA3.jar new file mode 100644 index 0000000..96f120a Binary files /dev/null and b/tests/ArchSimA3.jar differ diff --git a/tests/ArchSimModel.dtd b/tests/ArchSimModel.dtd new file mode 100644 index 0000000..31a71d8 --- /dev/null +++ b/tests/ArchSimModel.dtd @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/ComponentList.dtd b/tests/ComponentList.dtd new file mode 100644 index 0000000..d480fe1 --- /dev/null +++ b/tests/ComponentList.dtd @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/OperationList.dtd b/tests/OperationList.dtd new file mode 100644 index 0000000..6b69174 --- /dev/null +++ b/tests/OperationList.dtd @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/SimpleFleet.xml b/tests/SimpleFleet.xml new file mode 100644 index 0000000..e45a469 --- /dev/null +++ b/tests/SimpleFleet.xml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/archscript.g b/tests/archscript.g new file mode 100644 index 0000000..5e36d45 --- /dev/null +++ b/tests/archscript.g @@ -0,0 +1,45 @@ +// A grammar for assembling archsim networks + +s = !ws (Statement +/ ws) !ws + +Statement = Import | Instance | Settings | Operations + +Settings = "settings" (Setting+/newline) /newline +Setting = Name ^"=" quoted /ws + +Import = ^"import" JavaClassName "as" Type /ws +JavaClassName = Name +/ "." + +Instance = ^"component" !ws ComponentName !ws ":" !ws Type (!newline Connection +/ newline)? + +Connection = Port ^"->" ForeignPort /ws + | Port ^"<-" ForeignPort /ws + +ForeignPort = ComponentName ^"." Port + +Type = Name +Port = Name +ComponentName = Name +Name = string:: [a-zA-Z0-9_]++ + +quoted = "\"" ~[\"]* "\"" +newline = !ws "\n" !ws +ws = [\r\n ]** + | [\r\n ]** !Comment !ws +Comment = "//" ~[\n]* "\n" + | "/*" ~[\n]* "*/" + +Operations = ^"operations" (Operation+/newline) /newline +Operation = ^"build_GASP_model" + | ^"output" quoted /ws + | ^"journal" quoted /ws + | ^"error" quoted /ws + | ^"info" quoted /ws + | ^"run" [0-9]++ /ws + | ^"step" [0-9]++ /ws + | ^"self_check" + | ^"reset" + | ^"print_parameters" + | ^"print_components" + | ^"print_model" + | ^"print_model_description" diff --git a/tests/components.xml b/tests/components.xml new file mode 100644 index 0000000..2494edc --- /dev/null +++ b/tests/components.xml @@ -0,0 +1,7 @@ + + + +PayloadSourcecom.sunlabs.archsim.assignJan18.Source +PayloadSinkcom.sunlabs.archsim.assignJan18.Sink +FifoElementcom.sunlabs.archsim.assignJan18.FifoElement + diff --git a/tests/connections.xml b/tests/connections.xml new file mode 100644 index 0000000..11e601d --- /dev/null +++ b/tests/connections.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/tests/grappa.jar b/tests/grappa.jar new file mode 100644 index 0000000..8ee8988 Binary files /dev/null and b/tests/grappa.jar differ diff --git a/tests/input.tibdoc b/tests/input.tibdoc index 4650275..30d0d77 100644 --- a/tests/input.tibdoc +++ b/tests/input.tibdoc @@ -8,9 +8,9 @@ header this is the body adam@megacz.com text \today You can visit {my website}->adam@megacz.com with -- a !hyperlink to it! - The following demonstrates->http://www.slashdot.org/ verbatim stuff [[Knu68]], as - well \br as \br a \br footnote ((like)) because are - coool in an O(n^^3) way. + The following {demonstrates}->http://www.slashdot.org/ verbatim + stuff [[Knu68]], as well \br as \br a \br footnote ((like)) because + are coool in an O(n^^3) way. "" this is a test of \sc{paragraph of fun} the blockquote mechanism they,,{yer mom} diff --git a/tests/java.tc b/tests/java.tc new file mode 100644 index 0000000..d9dcf69 --- /dev/null +++ b/tests/java.tc @@ -0,0 +1,6 @@ +javacase { + input "1+1"; + s = Expr + Expr = left:Expr ^"+" right:Expr + | num:: num:[0-9]+ +} \ No newline at end of file diff --git a/tests/join.g b/tests/join.g new file mode 100644 index 0000000..0ad7281 --- /dev/null +++ b/tests/join.g @@ -0,0 +1,26 @@ + + + +Expr = + + + +ram addr data we -> data ack = + clock => we ? data -> storage.data[addr] + : + + +merge ( a b c ) = + a(x) => rega=x | a_ok + b(x) => regb=x | b_ok + a_ok & b_ok => c=x + + + +bit[32] +{ alpha= + + +X (datapath) +Event-of-X (control) + diff --git a/tests/library.xml b/tests/library.xml new file mode 100644 index 0000000..1498416 --- /dev/null +++ b/tests/library.xml @@ -0,0 +1,804 @@ + + + + + + + + + + + +SourceFunnel + com.sunlabs.archsim.fleet.HornAndFunnel.SourceFunnel + + + + + + + + + + + + + +InstructionHorn + com.sunlabs.archsim.fleet.HornAndFunnel.InstructionHorn + + + + + + + + + + +DestinationHorn + com.sunlabs.archsim.fleet.HornAndFunnel.DestinationHorn + + + + + + + + + + +DataMaskBranch + com.sunlabs.archsim.fleet.components.switchFabric.DataMaskBranch + + + + + + + + + + + + +DestinationMaskBranch + com.sunlabs.archsim.fleet.components.switchFabric.DestinationMaskBranch + + + + + + + + + + + + +SourceMaskBranch + com.sunlabs.archsim.fleet.components.switchFabric.SourceMaskBranch + + + + + + + + + + + + +ToggleBranch + com.sunlabs.archsim.fleet.components.switchFabric.ToggleBranch + + + + + + + + + + + +Merge + com.sunlabs.archsim.fleet.components.switchFabric.Merge + + + + + + + + + + + + + + + + + + + + + + + + + +DataPayloadMerge + com.sunlabs.archsim.fleet.HornAndFunnel.SourceSync + + + + + + + + + + + +Trunk + com.sunlabs.archsim.fleet.components.trunk.Trunk + + + + + + + + + + + + + + + + + + + + +FifoElement + com.sunlabs.archsim.fleet.ships.fifo.FifoElement + + + + + + + + + + + + + + +Fifo + com.sunlabs.archsim.fleet.ships.fifo.Fifo + + + + + + + + + + + + + + + + +FetchAndIssue + com.sunlabs.archsim.fleet.ships.fetchAndIssue.FetchAndIssue + + + + + + + + + + + + +Accumulator + com.sunlabs.archsim.fleet.ships.accumulator.Accumulator + + + + + + + + + + + +TokenAccumulator + com.sunlabs.archsim.fleet.ships.tokenaccumulator.TokenAccumulator + + + + + + + + + + + +Adder + com.sunlabs.archsim.fleet.ships.adder.Adder + + + + + + + + + + + + +TokenAdder + com.sunlabs.archsim.fleet.ships.tokenadder.TokenAdder + + + + + + + + + + + + + + + +AdderOOB + com.sunlabs.archsim.fleet.ships.adder_oob.Adder_oob + + + + + + + + + + + + +BitBucket + com.sunlabs.archsim.fleet.ships.bitbucket.BitBucket + + + + + + + + + + + + +Constant + com.sunlabs.archsim.fleet.ships.constant.Constant + + + + + + + + + + + + +Duplicator + com.sunlabs.archsim.fleet.ships.duplicator.Duplicator + + + + + + + + + + + + + +FifoShipElement + com.sunlabs.archsim.fleet.ships.fifo.FifoShipElement + + + + + + + + + + + + + + +FifoShip + com.sunlabs.archsim.fleet.ships.fifo.FifoShip + + + + + + + + + + + + + + +TokenFifoShipElement + com.sunlabs.archsim.fleet.ships.tokenFifo.TokenFifoShipElement + + + + + + + + + + + + + + + + + +TokenFifoShip + com.sunlabs.archsim.fleet.ships.tokenFifo.TokenFifoShip + + + + + + + + + + + + + + + + + + +SimpleMemory + com.sunlabs.archsim.fleet.ships.memory.SimpleMemory + + + + + + + + + + + + + + + + + + + + +Selector + com.sunlabs.archsim.fleet.ships.selector.Selector + + + + + + + + + + + + + +Stride + com.sunlabs.archsim.fleet.ships.stride.Stride + + + + + + + + + + + + + + + + + + + +TwoMerge + com.sunlabs.archsim.assignJan25.TwoMerge + + + +Toggle + com.sunlabs.archsim.assignJan25.Toggle + + + +RandomBranch + com.sunlabs.archsim.assignJan25.RandomBranch + + + +MaskBranch + com.sunlabs.archsim.assignJan25.MaskBranch + + + +PayloadSource + com.sunlabs.archsim.assignJan18.Source + + + +PayloadSink + com.sunlabs.archsim.assignJan18.Sink + + + + + + +TestDataSink + com.sunlabs.archsim.fleet.ships.testing.DataSink + + + + +TestDataSource + com.sunlabs.archsim.fleet.ships.testing.DataSource + + + + +TestIntegerSequenceSource + com.sunlabs.archsim.fleet.ships.testing.IntegerSequenceSource + + + + +TestPayloadSink + com.sunlabs.archsim.fleet.ships.testing.PayloadSink + + + + +TestPayloadSource + com.sunlabs.archsim.fleet.ships.testing.PayloadSource + + + + +TestTokenSource + com.sunlabs.archsim.fleet.ships.testing.TokenSource + + + + +InstructionHorn4 + com.sunlabs.archsim.fleet.components.hornAndFunnelFabric.InstructionHorn4 + + + + + + +InstructionHorn8 + com.sunlabs.archsim.fleet.components.hornAndFunnelFabric.InstructionHorn8 + + + +InstructionHorn16 + com.sunlabs.archsim.fleet.components.hornAndFunnelFabric.InstructionHorn16 + + + +SourceFunnel4 + com.sunlabs.archsim.fleet.components.hornAndFunnelFabric.SourceFunnel4 + + + +SourceFunnel8 + com.sunlabs.archsim.fleet.components.hornAndFunnelFabric.SourceFunnel8 + + + +SourceFunnel16 + com.sunlabs.archsim.fleet.components.hornAndFunnelFabric.SourceFunnel16 + + + +DestinationHorn4 + com.sunlabs.archsim.fleet.components.hornAndFunnelFabric.DestinationHorn4 + + + +DestinationHorn8 + com.sunlabs.archsim.fleet.components.hornAndFunnelFabric.DestinationHorn8 + + + +DestinationHorn16 + com.sunlabs.archsim.fleet.components.hornAndFunnelFabric.DestinationHorn16 + + + +InstructionGenerator + com.sunlabs.archsim.fleet.components.hornAndFunnelFabric.TestInstrGen + + + +InstrGen4 + com.sunlabs.archsim.fleet.components.hornAndFunnelFabric.TestInstrGen4 + + + +TestShip + com.sunlabs.archsim.fleet.components.hornAndFunnelFabric.TestShip + + + +TestShipRnd + com.sunlabs.archsim.fleet.components.hornAndFunnelFabric.TestShipRnd + + + diff --git a/tests/parameters.xml b/tests/parameters.xml new file mode 100644 index 0000000..68edf67 --- /dev/null +++ b/tests/parameters.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/regression.tc b/tests/regression.tc index cbb50ce..faba28d 100644 --- a/tests/regression.tc +++ b/tests/regression.tc @@ -355,6 +355,7 @@ testcase { testcase { input "aaaaa"; + output "top:{a q:{{a a a}} a}"; s = top:: z (q::"a"*) z z = a:: "a" } @@ -363,11 +364,11 @@ testcase { input "if (x) if (y) z else q"; output "if:{ident:{{x}} else:{if:{ident:{{y}} then:{ident:{{z}}}} ident:{{q}}}}"; - s = e + s = Expr Expr = if:: "if" "(" Expr ")" IfBody /ws | ident:: [a-z]++ - IfBody = else:: Expr "else" Expr /ws - | then:: Expr &~ ~[]* "else" Expr /ws + IfBody = else:: Expr "else" Expr /ws + | then:: Expr &~ (~[]* "else" !Expr /ws) ws = [ ]** } diff --git a/tests/scl.g b/tests/scl.g new file mode 100644 index 0000000..11f2dd1 --- /dev/null +++ b/tests/scl.g @@ -0,0 +1,107 @@ + + +data foo = bar; +type foo = bar; + +type Bit = 0 | 1 +type Char = Bit[16] +type Boolean = true | false +type Int32 = Bit[32] | oob +type Int64 = Bit[64] | oob +type Pointer = Bit[64] +type CodeBag = Pointer +type Void = token + +ship Adder3 (a b c -> d e f) + input e : ! + ... + + (x->a) => 3->b + +module latch32 + input data_in : Int32 + input transparent : Boolean! + output data_out : Int32 + private + state keeper : Int32 + data_out = keeper + transparent(true) => keeper = data_in + transparent(false) => keeper = keeper + +module flipflop + input dataIn : T + input clock : Void! + output dataOut : T + private + state keeper : T + data_out = keeper + clock() => keeper := + +module join + input in1 : Void! + input in2 : Void! + output out : Void! + private + +A single-clock synchronous system is therefore a system with only a single variable of event type. A synchronous sytem with mu + + +// how do you specify the initial state of keeper nodes? + +fleet + Adder3[1..3] + + +Type ::= Boolean + + + +Action = Action "," Action + | Value "->" Port+ + + +Identifier ::= Id | "(" Sym ")" + +Definition ::= Identifier "=" Body /ws + +Grammar ::= + +clock +random number generator +register +fifo +compare + +clear-read port + +// positioning of elements on the screen (psuedo-comment?) +// subcircuits +// ports (in, out) + +Parameter ::= Identifier (":" Type)? + + +andgate {a b}->{c d} = + input a, b + output c, d + + +module fifo + + +latch (input, hold) = + old = case + out = case + + + +and, xor, 2:1mux, 4:1mux + +leds, graphs, clock + +charing + +rs-latch +dq-flipflop + +parameterization (?) diff --git a/tests/script.xml b/tests/script.xml new file mode 100644 index 0000000..f398525 --- /dev/null +++ b/tests/script.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/tests/settings.xml b/tests/settings.xml new file mode 100644 index 0000000..102666f --- /dev/null +++ b/tests/settings.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test.archscript b/tests/test.archscript new file mode 100644 index 0000000..b5eaeab --- /dev/null +++ b/tests/test.archscript @@ -0,0 +1,38 @@ +import com.sunlabs.archsim.assignJan18.Source as PayloadSource +import com.sunlabs.archsim.assignJan18.Sink as PayloadSink +import com.sunlabs.archsim.assignJan18.FifoElement as FifoElement + +component Source:PayloadSource +component Sink:PayloadSink +component FifoOne:FifoElement + In <- Source.Out + Out -> Sink.In + +operations + print_parameters + build_GASP_model + self_check + print_model_description + reset + print_model + run 1000 + +settings + sourceDelay="50" + sourceDisplayGenerated="false" + sourceMaxGenerated="100" + sinkDelay="10" + sinkDisplayReceived="false" + sinkMaxStored="100" + fifo_forward_delay="10" + fifo_ack_delay="10" + state_to_action_delay="10" + action_to_state_delay="10" + action_fired_delay="0" + global_log="true" + log_level="0" + journal_state="true" + journal_action="false" + journal_terminal="false" + journalConnectionDataState="false" + journalConnectionAckState="false" diff --git a/tests/test.fleet b/tests/test.fleet new file mode 100644 index 0000000..744a0d6 --- /dev/null +++ b/tests/test.fleet @@ -0,0 +1,8 @@ + +// this is a test + + bob: { z -> q } + bob -> mary + mary := bob + + a -> foo, /* charles, */ baz diff --git a/tests/tibdoc.g b/tests/tibdoc.g index 68f2b03..ec31d30 100644 --- a/tests/tibdoc.g +++ b/tests/tibdoc.g @@ -67,7 +67,6 @@ SectionHeaderBody = "=" SectionHeaderBody "=" sp = " "** blank = !sp "\n" !sp "\n" !ws - kv = kv:: key:word "=" val:text /ws wp = w++ num = [0-9]++ @@ -85,17 +84,17 @@ text = Item Itemx = !ws Item | () Item = blockquote - > "[]":: { UL:: uli+/ws } Itemx - | "[]":: { OL:: oli+/ws } Itemx - > "[]":: pre Itemx - > "[]":: link Itemx - > "[]":: structured Itemx - > "[]":: styled Itemx - > "[]":: (Chars:: text:alphanum++) Itemx - > "[]":: "\"" text "\"" Itemx - > "[]":: symbol Itemx - > "[]":: (Symbol:: sym++) Itemx - > "[]":: Paragraph Itemx + > "[]":: { UL:: uli+/ws } Itemx + | "[]":: { OL:: oli+/ws } Itemx + > "[]":: pre Itemx + > "[]":: link Itemx + > "[]":: structured Itemx + > "[]":: styled Itemx + > "[]":: (Chars:: text:alphanum++) Itemx + > "[]":: "\"" text "\"" Itemx + > "[]":: symbol Itemx + > "[]":: (Symbol:: sym++) Itemx + > "[]":: Paragraph Itemx blockquote = Blockquote:: "\"\"" text "\"\"" | Blockquote:: "\"\"" block @@ -116,8 +115,8 @@ styled = Underline:: "__" text "__" block = { text } -link = Link:: text:({ text }) "->" href:(url|email) - > Link:: text:alphanum++ !ws "->" href:(url|email) +link = Link:: text:({ text }) "->" href:(url|email) + > Link:: text:alphanum++ !ws "->" href:(url|email) structured = command & "\\" [a-zA-Z0-9]++ block? > glyph