KCC - Kayte C Compiler 1.10.0
A C compiler implementation with preprocessor, lexer, parser, and code generator
Loading...
Searching...
No Matches
utils.h
1#ifndef UTILS_H
2#define UTILS_H
3
4#include "kcc.h" // Provides access to types like DataType, ASTNodeType, etc.
5
6// This header declares truly generic utility functions that can be used
7// across the entire compiler.
8
9// --- Memory Management Wrappers ---
10void* safe_malloc(size_t size);
11char* safe_strdup(const char *s);
12char* safe_strcpy(char *dest, const char *src, size_t size);
13
14
15// --- File I/O ---
16char* read_file(const char *filename);
17
18
19// --- Type Conversion & Debugging ---
20DataType token_to_data_type(TokenType type);
21const char* ast_node_type_to_string(ASTNodeType type);
22void ast_print(ASTNode *node, int indent);
23
24
25#endif // UTILS_H
26
AST Node structure.
Definition types.h:333
ASTNodeType
AST Node types.
Definition types.h:215
TokenType
Token types for lexical analysis.
Definition types.h:24
DataType
Data types supported by the compiler.
Definition types.h:193