KCC - Kayte C Compiler
1.10.0
A C compiler implementation with preprocessor, lexer, parser, and code generator
Loading...
Searching...
No Matches
include
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
29
char
* read_file(
const
char
* filename);
30
void
* safe_malloc(
size_t
size);
31
bool
safe_strcpy(
char
* dest,
size_t
dest_size,
const
char
* src);
32
char
* safe_strdup(
const
char
* src);
33
34
// Safe free macro
35
#define SAFE_FREE(ptr) do { \
36
if (ptr) { \
37
free(ptr); \
38
(ptr) = NULL; \
39
} \
40
} while(0)
41
42
// Compiler options
43
typedef
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
60
}
CompilerOptions
;
61
62
// Main compiler functions
63
int
compile_file(
const
char
*input_file,
const
char
*output_file,
CompilerOptions
*opts);
64
void
print_usage(
const
char
*program_name);
65
void
print_version(
void
);
66
67
#endif
// KCC_H
CompilerOptions
Definition
kcc.h:43
types.h
Type definitions for KCC compiler with Objective-C support.
Generated by
1.14.0