Removed the notion of a "large" context. For simplicity, all contexts
[panda.git] / tests / test-interpreter.c
blob580ee60193a82e4bd5314d1946e2bf4488c877a5
2 #include <st-types.h>
3 #include <st-symbol.h>
4 #include <st-compiler.h>
5 #include <st-cpu.h>
6 #include <st-array.h>
7 #include <st-lexer.h>
8 #include <st-node.h>
9 #include <st-universe.h>
10 #include <st-object.h>
11 #include <st-float.h>
13 #include <stdlib.h>
14 #include <stdio.h>
15 #include <stdbool.h>
17 #define BUF_SIZE 10000
19 int
20 main (int argc, char *argv[])
22 st_compiler_error error;
23 char buffer[BUF_SIZE];
24 char *string;
25 st_oop value;
26 char c;
27 int i = 0;
29 /* the big bang */
30 st_bootstrap_universe ();
32 while ((c = getchar ()) != EOF && i < (BUF_SIZE - 1))
33 buffer[i++] = c;
34 buffer[i] = '\0';
36 string = st_strconcat ("doIt ^ [", buffer, "] value", NULL);
38 bool result = st_compile_string (ST_UNDEFINED_OBJECT_CLASS, string, &error);
39 if (!result) {
40 fprintf (stderr, "test-processor:%i: %s\n",
41 error.line, error.message);
42 return 1;
45 st_cpu_initialize ();
47 st_cpu_main ();
49 /* inspect the returned value on top of the stack */
50 value = ST_STACK_PEEK ((&__cpu));
52 return 0;