aboutsummaryrefslogtreecommitdiff
path: root/ast.h
diff options
context:
space:
mode:
Diffstat (limited to 'ast.h')
-rw-r--r--ast.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/ast.h b/ast.h
new file mode 100644
index 0000000..f6db7da
--- /dev/null
+++ b/ast.h
@@ -0,0 +1,32 @@
+typedef struct {
+ enum {
+ /* Top Level */
+ PROG = 1024, FUNC_DEF, PARAMS,
+ DECL, /* declaration */
+ DECLR, /* declarator */
+ DECLRS,
+ INIT_DECLRS, INIT_DECLR,
+ INITR, /* initializer */
+ TYPE_SPEC,
+ STRUCT, UNION,
+ PLAIN_DECL, PLAIN_DECLR,
+
+ /* Statments */
+ EXP_STMT, /* expression-statment */
+ COMP_STMT, IF_STMT, /* selection-statment */
+ WHILE_STMT, FOR_STMT,
+ CONT_STMT , BREAK_STMT, RET_STMT, /* 'continue', 'break', 'return' */
+
+ /* Expressions (expressions use their token ID to denote their types */
+ EXP
+ } type;
+ union {
+ int intval;
+ char *strvar;
+ } rec;
+ struct CNode *chd, *next;
+ /* For error reporting */
+ struct Location {
+ int row, col;
+ } loc;
+} CNode;