add field specifiers
[ccc.git] / ast.h
diff --git a/ast.h b/ast.h
index 1bb93cb..13d3c58 100644 (file)
--- a/ast.h
+++ b/ast.h
@@ -9,6 +9,7 @@ enum binop {
        eq,neq,leq,le,geq,ge,
        cons,plus,minus,times,divide,modulo,power
 };
+enum fieldspec {fst,snd,hd,tl};
 enum unop {negate,inverse};
 enum ast_type {
        an_assign, an_binop, an_bool, an_char, an_cons, an_funcall, an_fundecl,
@@ -19,7 +20,7 @@ struct ast {
        enum ast_type type;
        union {
                struct {
-                       char *ident;
+                       struct ast *ident;
                        struct ast *expr;
                } an_assign;
                bool an_bool;
@@ -53,7 +54,11 @@ struct ast {
                        struct ast **els;
                } an_if;
                int an_int;
-               char *an_ident;
+               struct {
+                       char *ident;
+                       int nfields;
+                       enum fieldspec *fields;
+               } an_ident;
                struct {
                        int n;
                        struct ast **ptr;
@@ -86,7 +91,8 @@ struct ast *ast_funcall(struct ast *ident, struct ast *args);
 struct ast *ast_fundecl(struct ast *ident, struct ast *args, struct ast *body);
 struct ast *ast_if(struct ast *pred, struct ast *then, struct ast *els);
 struct ast *ast_int(int integer);
-struct ast *ast_ident(char *ident);
+struct ast *ast_identc(char *ident);
+struct ast *ast_ident(struct ast *ident, struct ast *fields);
 struct ast *ast_list(struct ast *llist);
 struct ast *ast_nil();
 struct ast *ast_return(struct ast *rtrn);