From 257bd248b0e8bbf3e2ab6d5c7ce81b2bf2fbff34 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Fri, 19 Dec 2014 19:05:48 +1100 Subject: Slightly more advanced grasp test programs --- src/Grasp/Examples/call_ret.grasp | 19 +++++++++++++++++++ src/Grasp/Examples/gets_stdin.grasp | 10 ++++++++++ src/Grasp/Examples/helloworld.grasp | 8 ++++++++ src/Grasp/Examples/implicit_push.grasp | 8 ++++++++ src/Grasp/Examples/pick.grasp | 18 ++++++++++++++++++ src/Grasp/Examples/pop.grasp | 12 ++++++++++++ src/Grasp/Examples/pop_empty.grasp | 8 ++++++++ src/Grasp/Examples/push.grasp | 10 ++++++++++ src/Grasp/Examples/push_empty.grasp | 8 ++++++++ src/Grasp/Examples/puts_list.grasp | 20 ++++++++++++++++++++ 10 files changed, 121 insertions(+) create mode 100644 src/Grasp/Examples/call_ret.grasp create mode 100644 src/Grasp/Examples/gets_stdin.grasp create mode 100644 src/Grasp/Examples/helloworld.grasp create mode 100644 src/Grasp/Examples/implicit_push.grasp create mode 100644 src/Grasp/Examples/pick.grasp create mode 100644 src/Grasp/Examples/pop.grasp create mode 100644 src/Grasp/Examples/pop_empty.grasp create mode 100644 src/Grasp/Examples/push.grasp create mode 100644 src/Grasp/Examples/push_empty.grasp create mode 100644 src/Grasp/Examples/puts_list.grasp (limited to 'src') diff --git a/src/Grasp/Examples/call_ret.grasp b/src/Grasp/Examples/call_ret.grasp new file mode 100644 index 0000000..a27286e --- /dev/null +++ b/src/Grasp/Examples/call_ret.grasp @@ -0,0 +1,19 @@ +digraph { + 1 [label="call"] + 2 [label="puts"] + 3 [label="grasp:main"] + 4 [label="myfunc"] + 5 [label="failure"] + 6 [label="set"] + 7 [label="success"] + 8 [label="ret"] + + 1 -> 3 [label="name"] + 1 -> 2 [label="next"] + 1 -> 4 [label="func"] + 6 -> 4 [label="name"] + 6 -> 8 [label="next"] + 6 -> 7 [label="in"] + 2 -> 5 [label="in"] + 1 -> 5 [label="out"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/gets_stdin.grasp b/src/Grasp/Examples/gets_stdin.grasp new file mode 100644 index 0000000..6bdcc0d --- /dev/null +++ b/src/Grasp/Examples/gets_stdin.grasp @@ -0,0 +1,10 @@ +digraph { + 1 [label="gets"] + 2 [label="grasp:main"] + 3 [label="out"] + 4 [label="thing"] + + 1 -> 2 [label="name"] + 1 -> 3 [label="out"] + 1 -> 4 [label="label"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/helloworld.grasp b/src/Grasp/Examples/helloworld.grasp new file mode 100644 index 0000000..c55a79b --- /dev/null +++ b/src/Grasp/Examples/helloworld.grasp @@ -0,0 +1,8 @@ +digraph { + 1 [label="puts"] + 2 [label="grasp:main"] + 3 [label="Hello world!"] + + 1 -> 2 [label="name"] + 1 -> 3 [label="in"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/implicit_push.grasp b/src/Grasp/Examples/implicit_push.grasp new file mode 100644 index 0000000..c104ef1 --- /dev/null +++ b/src/Grasp/Examples/implicit_push.grasp @@ -0,0 +1,8 @@ +digraph { + 1 [label="1"] + 2 [label="grasp:main"] + 3 [label="empty"] + + 1 -> 2 [label="name"] + 1 -> 3 [label="stack"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/pick.grasp b/src/Grasp/Examples/pick.grasp new file mode 100644 index 0000000..8fa78d8 --- /dev/null +++ b/src/Grasp/Examples/pick.grasp @@ -0,0 +1,18 @@ +digraph { + 1 [label="pick"] + 2 [label="grasp:main"] + 3 [label="first"] + 4 [label="second"] + 5 [label="third"] + 6 [label="empty"] + 7 [label="out"] + 8 [label="1"] + + 1 -> 2 [label="name"] + 1 -> 3 [label="stack"] + 1 -> 8 [label="depth"] + 3 -> 4 [label="next"] + 4 -> 5 [label="next"] + 5 -> 6 [label="next"] + 1 -> 7 [label="out"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/pop.grasp b/src/Grasp/Examples/pop.grasp new file mode 100644 index 0000000..804c903 --- /dev/null +++ b/src/Grasp/Examples/pop.grasp @@ -0,0 +1,12 @@ +digraph { + 1 [label="pop"] + 2 [label="grasp:main"] + 3 [label="empty"] + 4 [label="item"] + 5 [label="out"] + + 1 -> 2 [label="name"] + 1 -> 4 [label="stack"] + 4 -> 3 [label="next"] + 1 -> 5 [label="out"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/pop_empty.grasp b/src/Grasp/Examples/pop_empty.grasp new file mode 100644 index 0000000..f1a5f35 --- /dev/null +++ b/src/Grasp/Examples/pop_empty.grasp @@ -0,0 +1,8 @@ +digraph { + 1 [label="pop"] + 2 [label="grasp:main"] + 3 [label="empty"] + + 1 -> 2 [label="name"] + 1 -> 3 [label="stack"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/push.grasp b/src/Grasp/Examples/push.grasp new file mode 100644 index 0000000..11aa913 --- /dev/null +++ b/src/Grasp/Examples/push.grasp @@ -0,0 +1,10 @@ +digraph { + 1 [label="push"] + 2 [label="grasp:main"] + 3 [label="empty"] + 4 [label="abc"] + + 1 -> 2 [label="name"] + 1 -> 3 [label="stack"] + 1 -> 4 [label="in"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/push_empty.grasp b/src/Grasp/Examples/push_empty.grasp new file mode 100644 index 0000000..41dc8c2 --- /dev/null +++ b/src/Grasp/Examples/push_empty.grasp @@ -0,0 +1,8 @@ +digraph { + 1 [label="push"] + 2 [label="grasp:main"] + 3 [label="empty"] + + 1 -> 2 [label="name"] + 1 -> 3 [label="stack"] +} \ No newline at end of file diff --git a/src/Grasp/Examples/puts_list.grasp b/src/Grasp/Examples/puts_list.grasp new file mode 100644 index 0000000..b8f1b17 --- /dev/null +++ b/src/Grasp/Examples/puts_list.grasp @@ -0,0 +1,20 @@ +digraph { + 1 [label="puts"] + 2 [label="grasp:main"] + 3 [label="79"] + 4 [label="117"] + 5 [label="116"] + 6 [label="112"] + 7 [label="117"] + 8 [label="116"] + 9 [label="0"] + + 1 -> 2 [label="name"] + 1 -> 3 [label="in"] + 3 -> 4 [label="next"] + 4 -> 5 [label="next"] + 5 -> 6 [label="next"] + 6 -> 7 [label="next"] + 7 -> 8 [label="next"] + 8 -> 9 [label="next"] +} \ No newline at end of file -- cgit