#ifndef TYPE_H #define TYPE_H #include "tree.h" typedef struct param { char *name; struct typeinfo *type; struct param *next; } *paramlist; /* base types. In the real thing, there will be many more base types */ #define NULL_TYPE 1000000 #define INT_TYPE 1000001 #define STRUCT_TYPE 1000002 #define ARRAY_TYPE 1000003 #define FLOAT64_TYPE 1000004 #define FUNC_TYPE 1000005 #define MAP_TYPE 1000006 typedef struct typeinfo { int basetype; union { struct mapinfo { struct typeinfo *indextype; struct typeinfo *elemtype; }m; struct arrayinfo { int size; struct typeinfo *elemtype; }a; struct structinfo { struct sym_table *st; }c; struct funcinfo { char *name; /* ? */ struct sym_table *st; struct typeinfo *returntype; int nparams; struct param *parameters; }f; } u; } *typeptr; extern struct typeinfo integer_type; extern struct sym_table *foo; typeptr alctype(int); #ifdef NOT_THIS_YEAR typeptr alcclasstype(char *, struct sym_table *); typeptr alcmethodtype(nodeptr, nodeptr, struct sym_table *); #endif char *typename(typeptr t); extern typeptr integer_typeptr; extern typeptr null_typeptr; extern typeptr String_typeptr; extern char *typenam[]; #endif