summary refs log tree commit diff
path: root/src/instruction
diff options
context:
space:
mode:
Diffstat (limited to 'src/instruction')
-rw-r--r--src/instruction/decrement.c8
-rw-r--r--src/instruction/increment.c8
-rw-r--r--src/instruction/nop.c7
-rw-r--r--src/instruction/pushzero.c10
4 files changed, 33 insertions, 0 deletions
diff --git a/src/instruction/decrement.c b/src/instruction/decrement.c
new file mode 100644
index 0000000..f7f54dd
--- /dev/null
+++ b/src/instruction/decrement.c
@@ -0,0 +1,8 @@
+#include "3cl.h"
+#include "instruction.h"
+
+struct CCLFrame *ccl_instruction_decrement(struct CCL *ccl, struct CCLFrame *frame)
+{
+    --ccl->stack.stack[ccl->stack.cur];
+    return frame;
+}
diff --git a/src/instruction/increment.c b/src/instruction/increment.c
new file mode 100644
index 0000000..51697f1
--- /dev/null
+++ b/src/instruction/increment.c
@@ -0,0 +1,8 @@
+#include "3cl.h"
+#include "instruction.h"
+
+struct CCLFrame *ccl_instruction_increment(struct CCL *ccl, struct CCLFrame *frame)
+{
+    ++ccl->stack.stack[ccl->stack.cur];
+    return frame;
+}
diff --git a/src/instruction/nop.c b/src/instruction/nop.c
new file mode 100644
index 0000000..8e05396
--- /dev/null
+++ b/src/instruction/nop.c
@@ -0,0 +1,7 @@
+#include "3cl.h"
+#include "instruction.h"
+
+struct CCLFrame *ccl_instruction_nop(struct CCL *ccl, struct CCLFrame *frame)
+{
+    return frame;
+}
diff --git a/src/instruction/pushzero.c b/src/instruction/pushzero.c
new file mode 100644
index 0000000..ef380cd
--- /dev/null
+++ b/src/instruction/pushzero.c
@@ -0,0 +1,10 @@
+#include "3cl.h"
+#include "instruction.h"
+
+#include "stack.h"
+
+struct CCLFrame *ccl_instruction_pushzero(struct CCL *ccl, struct CCLFrame *frame)
+{
+    ccl_stack_push(&ccl->stack, 0);
+    return frame;
+}