aboutsummaryrefslogtreecommitdiffstats
path: root/forth.c
diff options
context:
space:
mode:
Diffstat (limited to 'forth.c')
-rw-r--r--forth.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/forth.c b/forth.c
index 0ebb7d5..cc437a2 100644
--- a/forth.c
+++ b/forth.c
@@ -40,6 +40,14 @@ void exec(stack *s, char *word, int len, char* line, int* i) {
case directive:
op->directive(s, len, line, i);
break;
+ case compiled:
+ for (int i = 0; i < op->oplistlen; i++) {
+ if (op->oplist[i].isliteral) {
+ stack_push(s, op->oplist[i].literal);
+ } else {
+ (op->oplist[i].stackop)(s);
+ }
+ }
}
} else if (isnumber(word)) {
stack_push(s, atoi(word));
@@ -67,8 +75,12 @@ void eval(stack* s, int len, char* line) {
}
}
+
int main(int argc, char** argv) {
+ optable_init();
+
stack* s = stack_new();
+
char *line = NULL;
size_t len = 0;
ssize_t read;