#endif
enum {
- O_RETURN=1
+ O_RET=1, O_NULL, O_SUB, O_MUL,
+ O_OR=5, O_LESS, O_EQ, O_ID, O_ADD,
+ O_NUM=10, O_FIELD, O_MTWO, O_MFOUR, O_MEIGHT,
+ O_MONE=15
};
-static char o_names[100][100] = {
- "",
- "O_RETURN"
+static char *o_names[] = {
+ "", "O_RET", "O_NULL", "O_SUB", "O_MUL",
+ "O_OR", "O_LESS", "O_EQ", "O_ID", "O_ADD",
+ "O_NUM", "O_FIELD", "O_MTWO", "O_MFOUR", "O_MEIGHT",
+ "O_MONE"
};
struct treenode {
long val;
char *reg;
struct treenode *parent;
- int skip;
int param_index;
+ int soffset;
};
typedef struct treenode *treenodep;
#define PANIC printf
struct treenode *new_node(int op, struct treenode *l, struct treenode *r);
+struct treenode *new_number(long val);
+struct treenode *new_param(int op, char *name, struct treenode *l, struct treenode *r, int param_index);
+struct treenode *new_field(char *name, struct treenode *l, struct treenode *r, int soffset);
+void write_tree(struct treenode *node, int ident);
#endif