summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2014-12-19 19:05:48 +1100
committerJed Barber <jjbarber@y7mail.com>2014-12-19 19:05:48 +1100
commit257bd248b0e8bbf3e2ab6d5c7ce81b2bf2fbff34 (patch)
treed3c5a8ec2d81c706c5e56f9aa1dc1ff81f37f696 /src
parentd5ec72501f774c86d1fbe3c74b4edafc5065987e (diff)
Slightly more advanced grasp test programs
Diffstat (limited to 'src')
-rw-r--r--src/Grasp/Examples/call_ret.grasp19
-rw-r--r--src/Grasp/Examples/gets_stdin.grasp10
-rw-r--r--src/Grasp/Examples/helloworld.grasp8
-rw-r--r--src/Grasp/Examples/implicit_push.grasp8
-rw-r--r--src/Grasp/Examples/pick.grasp18
-rw-r--r--src/Grasp/Examples/pop.grasp12
-rw-r--r--src/Grasp/Examples/pop_empty.grasp8
-rw-r--r--src/Grasp/Examples/push.grasp10
-rw-r--r--src/Grasp/Examples/push_empty.grasp8
-rw-r--r--src/Grasp/Examples/puts_list.grasp20
10 files changed, 121 insertions, 0 deletions
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