From a3844616b62aae43e7aa12da6df852628acab504 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Wed, 17 Dec 2014 13:41:56 +1100 Subject: Test Grasp programs for general purpose, arithmetic, simple IO --- src/Grasp/Examples/add.grasp | 14 ++++++++++++++ src/Grasp/Examples/add_empty.grasp | 8 ++++++++ src/Grasp/Examples/cat.grasp | 29 +++++++++++++++++++++++++++++ src/Grasp/Examples/del.grasp | 7 +++++++ src/Grasp/Examples/div.grasp | 16 ++++++++++++++++ src/Grasp/Examples/div_empty.grasp | 10 ++++++++++ src/Grasp/Examples/getc_stdin.grasp | 10 ++++++++++ src/Grasp/Examples/mod.grasp | 14 ++++++++++++++ src/Grasp/Examples/mul.grasp | 16 ++++++++++++++++ src/Grasp/Examples/mul_empty.grasp | 8 ++++++++ src/Grasp/Examples/new.grasp | 10 ++++++++++ src/Grasp/Examples/new_next.grasp | 11 +++++++++++ src/Grasp/Examples/putc_stdout.grasp | 8 ++++++++ src/Grasp/Examples/putc_stdout_multi.grasp | 12 ++++++++++++ src/Grasp/Examples/ret_empty.grasp | 6 ++++++ src/Grasp/Examples/set.grasp | 12 ++++++++++++ src/Grasp/Examples/set_empty.grasp | 6 ++++++ src/Grasp/Examples/set_multi.grasp | 12 ++++++++++++ src/Grasp/Examples/sub.grasp | 16 ++++++++++++++++ src/Grasp/Examples/sub_empty.grasp | 10 ++++++++++ src/Grasp/cat.grasp | 29 ----------------------------- 21 files changed, 235 insertions(+), 29 deletions(-) create mode 100644 src/Grasp/Examples/add.grasp create mode 100644 src/Grasp/Examples/add_empty.grasp create mode 100644 src/Grasp/Examples/cat.grasp create mode 100644 src/Grasp/Examples/del.grasp create mode 100644 src/Grasp/Examples/div.grasp create mode 100644 src/Grasp/Examples/div_empty.grasp create mode 100644 src/Grasp/Examples/getc_stdin.grasp create mode 100644 src/Grasp/Examples/mod.grasp create mode 100644 src/Grasp/Examples/mul.grasp create mode 100644 src/Grasp/Examples/mul_empty.grasp create mode 100644 src/Grasp/Examples/new.grasp create mode 100644 src/Grasp/Examples/new_next.grasp create mode 100644 src/Grasp/Examples/putc_stdout.grasp create mode 100644 src/Grasp/Examples/putc_stdout_multi.grasp create mode 100644 src/Grasp/Examples/ret_empty.grasp create mode 100644 src/Grasp/Examples/set.grasp create mode 100644 src/Grasp/Examples/set_empty.grasp create mode 100644 src/Grasp/Examples/set_multi.grasp create mode 100644 src/Grasp/Examples/sub.grasp create mode 100644 src/Grasp/Examples/sub_empty.grasp delete mode 100644 src/Grasp/cat.grasp (limited to 'src') diff --git a/src/Grasp/Examples/add.grasp b/src/Grasp/Examples/add.grasp new file mode 100644 index 0000000..a480768 --- /dev/null +++ b/src/Grasp/Examples/add.grasp @@ -0,0 +1,14 @@ +digraph { + 1 [label="add"] + 2 [label="grasp:main"] + 3 [label="1"] + 4 [label="2.3"] + 5 [label="out1"] + 6 [label="out2"] + + 1 -> 2 [label="name"] + 1 -> 3 [label="arg"] + 1 -> 4 [label="arg"] + 1 -> 5 [label="out"] + 1 -> 6 [label="out"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/add_empty.grasp b/src/Grasp/Examples/add_empty.grasp new file mode 100644 index 0000000..ec624ef --- /dev/null +++ b/src/Grasp/Examples/add_empty.grasp @@ -0,0 +1,8 @@ +digraph { + 1 [label="add"] + 2 [label="grasp:main"] + 3 [label="out"] + + 1 -> 2 [label="name"] + 1 -> 3 [label="out"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/cat.grasp b/src/Grasp/Examples/cat.grasp new file mode 100644 index 0000000..f629ac1 --- /dev/null +++ b/src/Grasp/Examples/cat.grasp @@ -0,0 +1,29 @@ +digraph { + 1 [label="getc"]; + 2 [label="grasp:main"]; + 3 [label="c"]; + 4 [label="add"]; + 5 [label="1"]; + 6 [label="c+1"]; + 7 [label="del"]; + 8 [label="next"]; + 9 [label="new"]; + 10 [label="putc"]; + + 1 -> 2 [label="name"]; + 1 -> 3 [label="out"]; + 1 -> 4 [label="next"]; + 4 -> 5 [label="arg"]; + 4 -> 3 [label="arg"]; + 4 -> 6 [label="out"]; + 4 -> 7 [label="next"]; + 7 -> 8 [label="label"]; + 7 -> 9 [label="next"]; + 7 -> 9 [label="tail"]; + 9 -> 6 [label="cond"]; + 9 -> 9 [label="tail"]; + 9 -> 8 [label="label"]; + 9 -> 10 [label="head"]; + 10 -> 3 [label="in"]; + 10 -> 1 [label="next"]; +} \ No newline at end of file diff --git a/src/Grasp/Examples/del.grasp b/src/Grasp/Examples/del.grasp new file mode 100644 index 0000000..b57e146 --- /dev/null +++ b/src/Grasp/Examples/del.grasp @@ -0,0 +1,7 @@ +digraph { + 1 [label="del"] + 2 [label="grasp:main"] + + 1 -> 2 [label="name"] + 1 -> 1 [label="tail"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/div.grasp b/src/Grasp/Examples/div.grasp new file mode 100644 index 0000000..a8633e0 --- /dev/null +++ b/src/Grasp/Examples/div.grasp @@ -0,0 +1,16 @@ +digraph { + 1 [label="div"] + 2 [label="grasp:main"] + 3 [label="15"] + 4 [label="2"] + 5 [label="3"] + 6 [label="out1"] + 7 [label="out2"] + + 1 -> 2 [label="name"] + 1 -> 3 [label="left"] + 1 -> 4 [label="right"] + 1 -> 5 [label="right"] + 1 -> 6 [label="out"] + 1 -> 7 [label="out"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/div_empty.grasp b/src/Grasp/Examples/div_empty.grasp new file mode 100644 index 0000000..a00d983 --- /dev/null +++ b/src/Grasp/Examples/div_empty.grasp @@ -0,0 +1,10 @@ +digraph { + 1 [label="div"] + 2 [label="grasp:main"] + 3 [label="15"] + 4 [label="out"] + + 1 -> 2 [label="name"] + 1 -> 3 [label="left"] + 1 -> 4 [label="out"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/getc_stdin.grasp b/src/Grasp/Examples/getc_stdin.grasp new file mode 100644 index 0000000..2e50326 --- /dev/null +++ b/src/Grasp/Examples/getc_stdin.grasp @@ -0,0 +1,10 @@ +digraph { + 1 [label="getc"] + 2 [label="grasp:main"] + 3 [label="out1"] + 4 [label="out2"] + + 1 -> 2 [label="name"] + 1 -> 3 [label="out"] + 1 -> 4 [label="out"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/mod.grasp b/src/Grasp/Examples/mod.grasp new file mode 100644 index 0000000..c48c9ba --- /dev/null +++ b/src/Grasp/Examples/mod.grasp @@ -0,0 +1,14 @@ +digraph { + 1 [label="mod"] + 2 [label="grasp:main"] + 3 [label="10"] + 4 [label="4"] + 5 [label="out1"] + 6 [label="out2"] + + 1 -> 2 [label="name"] + 1 -> 3 [label="left"] + 1 -> 4 [label="right"] + 1 -> 5 [label="out"] + 1 -> 6 [label="out"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/mul.grasp b/src/Grasp/Examples/mul.grasp new file mode 100644 index 0000000..ad2baef --- /dev/null +++ b/src/Grasp/Examples/mul.grasp @@ -0,0 +1,16 @@ +digraph { + 1 [label="mul"] + 2 [label="grasp:main"] + 3 [label="2"] + 4 [label="5.3"] + 5 [label="3"] + 6 [label="out1"] + 7 [label="out2"] + + 1 -> 2 [label="name"] + 1 -> 3 [label="arg"] + 1 -> 4 [label="arg"] + 1 -> 5 [label="arg"] + 1 -> 6 [label="out"] + 1 -> 7 [label="out"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/mul_empty.grasp b/src/Grasp/Examples/mul_empty.grasp new file mode 100644 index 0000000..cbb06bc --- /dev/null +++ b/src/Grasp/Examples/mul_empty.grasp @@ -0,0 +1,8 @@ +digraph { + 1 [label="mul"] + 2 [label="grasp:main"] + 3 [label="out"] + + 1 -> 2 [label="name"] + 1 -> 3 [label="out"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/new.grasp b/src/Grasp/Examples/new.grasp new file mode 100644 index 0000000..959e5c8 --- /dev/null +++ b/src/Grasp/Examples/new.grasp @@ -0,0 +1,10 @@ +digraph { + 1 [label="new"] + 2 [label="grasp:main"] + 3 [label="test"] + + 1 -> 2 [label="name"] + 1 -> 1 [label="tail"] + 1 -> 1 [label="head"] + 1 -> 3 [label="label"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/new_next.grasp b/src/Grasp/Examples/new_next.grasp new file mode 100644 index 0000000..9d5a442 --- /dev/null +++ b/src/Grasp/Examples/new_next.grasp @@ -0,0 +1,11 @@ +digraph { + 1 [label="new"] + 2 [label="grasp:main"] + 3 [label="next"] + 4 [label="set"] + + 1 -> 2 [label="name"] + 1 -> 1 [label="tail"] + 1 -> 4 [label="head"] + 1 -> 3 [label="label"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/putc_stdout.grasp b/src/Grasp/Examples/putc_stdout.grasp new file mode 100644 index 0000000..14c7d92 --- /dev/null +++ b/src/Grasp/Examples/putc_stdout.grasp @@ -0,0 +1,8 @@ +digraph { + 1 [label="putc"] + 2 [label="grasp:main"] + 3 [label="100"] + + 1 -> 2 [label="name"] + 1 -> 3 [label="in"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/putc_stdout_multi.grasp b/src/Grasp/Examples/putc_stdout_multi.grasp new file mode 100644 index 0000000..0ddc692 --- /dev/null +++ b/src/Grasp/Examples/putc_stdout_multi.grasp @@ -0,0 +1,12 @@ +digraph { + 1 [label="putc"] + 2 [label="grasp:main"] + 3 [label="100"] + 4 [label="101"] + 5 [label="102"] + + 1 -> 2 [label="name"] + 1 -> 3 [label="in"] + 1 -> 4 [label="in"] + 1 -> 5 [label="in"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/ret_empty.grasp b/src/Grasp/Examples/ret_empty.grasp new file mode 100644 index 0000000..4a85da6 --- /dev/null +++ b/src/Grasp/Examples/ret_empty.grasp @@ -0,0 +1,6 @@ +digraph { + 1 [label="ret"]; + 2 [label="grasp:main"]; + + 1 -> 2 [label="name"]; +} \ No newline at end of file diff --git a/src/Grasp/Examples/set.grasp b/src/Grasp/Examples/set.grasp new file mode 100644 index 0000000..7d3ee98 --- /dev/null +++ b/src/Grasp/Examples/set.grasp @@ -0,0 +1,12 @@ +digraph { + 1 [label="set"] + 2 [label="grasp:main"] + 3 [label="abc"] + 4 [label="out1"] + 5 [label="out2"] + + 1 -> 2 [label="name"] + 1 -> 3 [label="in"] + 1 -> 4 [label="out"] + 1 -> 5 [label="out"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/set_empty.grasp b/src/Grasp/Examples/set_empty.grasp new file mode 100644 index 0000000..94be1c8 --- /dev/null +++ b/src/Grasp/Examples/set_empty.grasp @@ -0,0 +1,6 @@ +digraph { + 1 [label="set"] + 2 [label="grasp:main"] + + 1 -> 2 [label="name"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/set_multi.grasp b/src/Grasp/Examples/set_multi.grasp new file mode 100644 index 0000000..a2a8acb --- /dev/null +++ b/src/Grasp/Examples/set_multi.grasp @@ -0,0 +1,12 @@ +digraph { + 1 [label="set"] + 2 [label="grasp:main"] + 3 [label="abc"] + 4 [label="def"] + 5 [label="out"] + + 1 -> 2 [label="name"] + 1 -> 3 [label="in"] + 1 -> 4 [label="in"] + 1 -> 5 [label="out"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/sub.grasp b/src/Grasp/Examples/sub.grasp new file mode 100644 index 0000000..9d379ec --- /dev/null +++ b/src/Grasp/Examples/sub.grasp @@ -0,0 +1,16 @@ +digraph { + 1 [label="sub"] + 2 [label="grasp:main"] + 3 [label="10"] + 4 [label="2"] + 5 [label="2.1"] + 6 [label="out1"] + 7 [label="out2"] + + 1 -> 2 [label="name"] + 1 -> 3 [label="left"] + 1 -> 4 [label="right"] + 1 -> 5 [label="right"] + 1 -> 6 [label="out"] + 1 -> 7 [label="out"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/sub_empty.grasp b/src/Grasp/Examples/sub_empty.grasp new file mode 100644 index 0000000..74ad7f0 --- /dev/null +++ b/src/Grasp/Examples/sub_empty.grasp @@ -0,0 +1,10 @@ +digraph { + 1 [label="sub"] + 2 [label="grasp:main"] + 3 [label="10"] + 4 [label="out"] + + 1 -> 2 [label="name"] + 1 -> 3 [label="left"] + 1 -> 4 [label="out"] +} \ No newline at end of file diff --git a/src/Grasp/cat.grasp b/src/Grasp/cat.grasp deleted file mode 100644 index f629ac1..0000000 --- a/src/Grasp/cat.grasp +++ /dev/null @@ -1,29 +0,0 @@ -digraph { - 1 [label="getc"]; - 2 [label="grasp:main"]; - 3 [label="c"]; - 4 [label="add"]; - 5 [label="1"]; - 6 [label="c+1"]; - 7 [label="del"]; - 8 [label="next"]; - 9 [label="new"]; - 10 [label="putc"]; - - 1 -> 2 [label="name"]; - 1 -> 3 [label="out"]; - 1 -> 4 [label="next"]; - 4 -> 5 [label="arg"]; - 4 -> 3 [label="arg"]; - 4 -> 6 [label="out"]; - 4 -> 7 [label="next"]; - 7 -> 8 [label="label"]; - 7 -> 9 [label="next"]; - 7 -> 9 [label="tail"]; - 9 -> 6 [label="cond"]; - 9 -> 9 [label="tail"]; - 9 -> 8 [label="label"]; - 9 -> 10 [label="head"]; - 10 -> 3 [label="in"]; - 10 -> 1 [label="next"]; -} \ No newline at end of file -- cgit