enum NodeKind { NODE_FUNCTION, NODE_VAR_DECL, NODE_TYPEDEF, NODE_STRUCT, NODE_RETURN, NODE_BINARY_OP, NODE_LITERAL, NODE_IDENTIFIER, NODE_CALL, NODE_BLOCK, } struct ASTNode { NodeKind kind; union { FunctionNode fn; VarDeclNode var; TypedefNode td; StructNode str; ExprNode expr; BlockNode block; } } // Function struct FunctionNode { String name; String return_type; List params; BlockNode body; bool is_inline; bool is_static; bool is_export; bool is_extern; bool is_asm; } // Variable declaration struct VarDeclNode { String name; String type; ExprNode* init; // optional bool is_raw; } // Block struct BlockNode { List statements; } // Typedef struct TypedefNode { String alias; String type; } // Struct struct StructNode { String name; List fields; } // Expression enum ExprKind { EXPR_LITERAL, EXPR_IDENTIFIER, EXPR_BINARY, EXPR_CALL, EXPR_CAST } struct ExprNode { ExprKind kind; union { LiteralNode lit; String ident; BinaryExprNode bin; CallExprNode call; CastExprNode cast; } } // Binary op struct BinaryExprNode { String op; ExprNode* lhs; ExprNode* rhs; } // Function call struct CallExprNode { String callee; List args; } // Literal struct LiteralNode { String value; // numeric, char, string }