#include <stdbool.h>
#include "util.h"
+#include "type.h"
struct ast;
#include "parse.h"
struct stmt **body;
};
-enum basictype {btbool, btchar, btint, btvoid};
-struct type {
- enum {tbasic,tlist,ttuple,tvar} type;
- union {
- enum basictype tbasic;
- struct type *tlist;
- struct {
- struct type *l;
- struct type *r;
- } ttuple;
- char *tvar;
- } data;
-};
-
struct decl {
//NOTE: DON'T CHANGE THIS ORDER
enum {dcomp, dvardecl, dfundecl} type;
struct expr *expr_string(char *str);
struct expr *expr_unop(enum unop op, struct expr *l);
-struct type *type_basic(enum basictype type);
-struct type *type_list(struct type *type);
-struct type *type_tuple(struct type *l, struct type *r);
-struct type *type_var(char *ident);
-
void ast_print(struct ast *, FILE *out);
void vardecl_print(struct vardecl *decl, int indent, FILE *out);
void fundecl_print(struct fundecl *decl, FILE *out);
void decl_print(struct decl *ast, FILE *out);
void stmt_print(struct stmt *ast, int indent, FILE *out);
void expr_print(struct expr *ast, FILE *out);
-void type_print(struct type *type, FILE *out);
void ast_free(struct ast *);
void vardecl_free(struct vardecl *decl);
void decl_free(struct decl *ast);
void stmt_free(struct stmt *ast);
void expr_free(struct expr *ast);
-void type_free(struct type *type);
#endif