Removed the notion of a "large" context. For simplicity, all contexts
[panda.git] / src / st-compiler.h
blobed8388f26201816773ee174cec9a49d2b83bd583
4 #ifndef __ST_COMPILER_H__
5 #define __ST_COMPILER_H__
7 #include <st-types.h>
8 #include <st-utils.h>
9 #include <st-lexer.h>
10 #include <st-node.h>
12 typedef struct st_compiler_error
14 char message[255];
16 st_uint line;
17 st_uint column;
18 } st_compiler_error;
20 bool st_compile_string (st_oop class,
21 const char *string,
22 st_compiler_error *error);
24 void st_compile_file_in (const char *filename);
26 st_node *st_parser_parse (st_lexer *lexer,
27 st_compiler_error *error);
29 st_oop st_generate_method (st_oop class,
30 st_node *node,
31 st_compiler_error *error);
33 void st_print_method (st_oop method);
35 /* bytecodes */
36 typedef enum
38 PUSH_TEMP = 0,
39 PUSH_INSTVAR,
40 PUSH_LITERAL_CONST,
41 PUSH_LITERAL_VAR,
43 STORE_LITERAL_VAR,
44 STORE_TEMP,
45 STORE_INSTVAR,
47 STORE_POP_LITERAL_VAR,
48 STORE_POP_TEMP,
49 STORE_POP_INSTVAR,
51 PUSH_SELF,
52 PUSH_NIL,
53 PUSH_TRUE,
54 PUSH_FALSE,
55 PUSH_INTEGER,
57 RETURN_STACK_TOP,
58 BLOCK_RETURN,
60 POP_STACK_TOP,
61 DUPLICATE_STACK_TOP,
63 PUSH_ACTIVE_CONTEXT,
65 BLOCK_COPY,
67 JUMP_TRUE,
68 JUMP_FALSE,
69 JUMP,
71 SEND, /* B, B (arg count), B (selector index) */
72 SEND_SUPER,
74 SEND_PLUS,
75 SEND_MINUS,
76 SEND_LT,
77 SEND_GT,
78 SEND_LE,
79 SEND_GE,
80 SEND_EQ,
81 SEND_NE,
82 SEND_MUL,
83 SEND_DIV,
84 SEND_MOD,
85 SEND_BITSHIFT,
86 SEND_BITAND,
87 SEND_BITOR,
88 SEND_BITXOR,
90 SEND_AT,
91 SEND_AT_PUT,
92 SEND_SIZE,
93 SEND_VALUE,
94 SEND_VALUE_ARG,
95 SEND_IDENTITY_EQ,
96 SEND_CLASS,
97 SEND_NEW,
98 SEND_NEW_ARG,
100 } Code;
102 #endif /* __ST_COMPILER_H__ */