typedef enum
{
StmtK,
ExpK
}NodeKind;
typedef enum
{
IfK,
RepeatK,
AssignK,
ReadK,
WriteK
}StmtKind;
typedef enum
{
OpK,
ConstK,
IdK
}ExpKind;
typedef enum
{
Void,
Interger,
Boolean
} ExpType;
#define MAXCHILDREN 3
typedef struct treeNode
{
treeNode* child[MAXCHILDREN];
treeNode* sibling;
int lineno;
NodeKind nodekind;
union
{
StmtKind stmt;
ExpKind exp;
}kind;
union
{
TokenType op;
int val;
char* name;
} attr;
ExpType type;
} TreeNode;