+/* code.c */
+#define BUFSIZE 4096
+#define HASHSIZE 103
+#define MAGIC 19
+
+struct code {
+ struct node car;
+ enum {
+ OPC_SET,
+ OPC_JUMP,
+ OPC_JUMP_IF,
+ OPC_JUMP_UNLESS,
+ OPC_DELIVER,
+ OPC_CALL_EXT,
+ OPC_NOP,
+ OPC_CAT,
+ OPC_GT,
+ OPC_LT,
+ OPC_LE,
+ OPC_GE,
+ OPC_EQ,
+ OPC_NEQ,
+ OPC_RE,
+ OPC_NRE,
+ OPC_AND,
+ OPC_OR,
+ OPC_XOR,
+ OPC_NOT,
+ OPC_PLUS,
+ OPC_MINUS,
+ OPC_MUL,
+ OPC_DIV,
+ OPC_PIPE,
+ OPC_MAIL,
+ OPC_DISCARD
+ } opcode;
+
+ union {
+ struct {
+ struct code* target;
+ } jump;
+ struct {
+ struct code* target;
+ int cond;
+ } jump_if;
+ struct {
+ struct code* target;
+ int cond;
+ } jump_unless;
+ struct {
+ int l;
+ int r;
+ } set;
+ struct {
+ int l;
+ int r;
+ int res; /* result */
+ } tpop;
+ struct {
+ int par;
+ int res; /* result */
+ } dpop;
+ struct {
+ int copy;
+ int what;
+ } arrow;
+ struct {
+ } nop;
+ } u;
+};
+
+struct variable {
+ struct node car;
+ char* name;
+ int varcode;
+ int modified;
+};
+
+struct list input_code;
+struct list* var_hash;
+int current_varcode;
+int max_varcode;
+int temp_varcode_start;
+char** var_tab;
+char** const_tab;
+int cur_const_n;
+int cur_const_s;
+
+void init(void);
+void compile(struct tree* t, struct list* where);
+int find_var(char* name, struct list* hash);
+int store_const(char* c);
+struct list* new_var_hash(void);
+int get_bucket_number(char* name);
+void print_code(void);
+