Parsing exprs, enum_decls, Introduce intern table, symbol table
This commit is contained in:
50
expr.h
Normal file
50
expr.h
Normal file
@@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
typedef struct Expr Expr;
|
||||
|
||||
typedef enum Expr_Kind{
|
||||
EK_None,
|
||||
EK_Atom,
|
||||
EK_Unary,
|
||||
EK_Binary,
|
||||
EK_Ternary,
|
||||
EK_Cast,
|
||||
EK_List,
|
||||
EK_Call,
|
||||
EK_Index,
|
||||
} Expr_Kind;
|
||||
|
||||
struct Expr {
|
||||
Expr_Kind kind;
|
||||
Token *token;
|
||||
Expr *next;
|
||||
union {
|
||||
struct {
|
||||
Type *type;
|
||||
Expr* expr;
|
||||
} cast;
|
||||
struct {
|
||||
Expr *first;
|
||||
Expr *last;
|
||||
} list;
|
||||
struct {
|
||||
Expr *atom;
|
||||
Expr *list;
|
||||
} call;
|
||||
struct {
|
||||
Expr *atom;
|
||||
Expr *index;
|
||||
} index;
|
||||
struct {
|
||||
Expr* expr;
|
||||
} unary;
|
||||
struct {
|
||||
Expr* left;
|
||||
Expr* right;
|
||||
} binary;
|
||||
struct {
|
||||
Expr* cond;
|
||||
Expr* on_true;
|
||||
Expr* on_false;
|
||||
} ternary;
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user