KCC - Kayte C Compiler 1.10.0
A C compiler implementation with preprocessor, lexer, parser, and code generator
Loading...
Searching...
No Matches
kcc.h
1#ifndef KCC_H
2#define KCC_H
3
4#include <stdio.h>
5#include <stdlib.h>
6#include <string.h>
7#include <stdbool.h>
8#include <ctype.h>
9#include <stdarg.h>
10
11#define KCC_VERSION "1.2.3"
12#define MAX_TOKENS 1024
13#define MAX_NODES 512
14#define MAX_IDENTIFIER_LENGTH 256
15#define MAX_STRING_LENGTH 1024
16
17// Include types first so all structs and enums are defined
18#include "types.h"
19
20// Include headers in correct order
21#include "error.h"
22#include "lexer.h"
23#include "ast.h"
24#include "parser.h"
25#include "codegen.h"
26#include "preprocessor.h"
27
28// Essential utility functions
29char* read_file(const char* filename);
30void* safe_malloc(size_t size);
31bool safe_strcpy(char* dest, size_t dest_size, const char* src);
32char* safe_strdup(const char* src);
33
34// Safe free macro
35#define SAFE_FREE(ptr) do { \
36if (ptr) { \
37free(ptr); \
38(ptr) = NULL; \
39} \
40} while(0)
41
42// Compiler options
43typedef struct {
44 char *input_file;
45 char *output_file;
46 bool verbose;
47 bool debug;
48 bool optimize;
49 bool keep_asm;
50 bool no_preprocess; // Skip preprocessing
51 bool preprocess_only; // Only run preprocessor
52 char **user_macros; // User-defined macros from command line
53 int macro_count; // Number of user macros
54 bool include_env; // Include environment variable macros
55 bool include_system; // Include system information macros
56 char *target_arch; // Target architecture (x86_64, arm64)
57 char *target_platform; // Target platform (linux, macos)
58 bool use_multiarch; // Use multi-architecture codegen
59
61
62// Main compiler functions
63int compile_file(const char *input_file, const char *output_file, CompilerOptions *opts);
64void print_usage(const char *program_name);
65void print_version(void);
66
67#endif // KCC_H
Type definitions for KCC compiler with Objective-C support.