17#include "../ast/ast.h"
18#include "../c_libs/memory/memory.h"
19#include "../lexer/lexer.h"
20#include "../llvm/llvm.h"
23#define TOKEN_AT(i) (((Token *)tokens.data)[(i)])
29#define DEBUG_ARENA_ALLOC 1
31#define Luma_Compiler_version "v0.2.6"
76const char *
read_file(
const char *filename);
106bool link_with_ld(
const char *obj_filename,
const char *exe_filename);
bool PathIsDir(const char *p)
Definition help.c:158
bool link_with_ld(const char *obj_filename, const char *exe_filename)
Links object file using ld to create an executable (Unix/Linux)
Definition help.c:535
bool parse_args(int argc, char *argv[], BuildConfig *config, ArenaAllocator *arena)
Parses command-line arguments and configures the build.
Definition help.c:268
const char * detect_target_os(void)
Definition help.c:216
bool get_gcc_file_path(const char *filename, char *buffer, size_t buffer_size)
Get a file path from gcc.
Definition help.c:618
void save_module_output_files(CodeGenContext *ctx, const char *output_dir)
Definition run.c:45
ErrorCode
Definition help.h:34
@ MEMORY_ERROR
Definition help.h:37
@ RUNTIME_ERROR
Definition help.h:40
@ ARGC_ERROR
Definition help.h:35
@ FILE_ERROR
Definition help.h:36
@ UNKNOWN_ERROR
Definition help.h:41
@ PARSER_ERROR
Definition help.h:39
@ LEXER_ERROR
Definition help.h:38
AstNode * lex_and_parse_file(const char *path, ArenaAllocator *allocator, BuildConfig *config)
Definition run.c:402
int print_license()
Prints license information.
Definition help.c:134
void print_token(const Token *t)
Prints a token's text and its token type with color formatting.
Definition help.c:387
void timer_stop(CompileTimer *timer)
Definition help.c:774
void ensure_clean_line()
Definition help.c:767
void print_progress(int step, int total, const char *stage)
Definition help.c:742
bool get_lib_paths(char *buffer, size_t buffer_size)
Get the system's library search paths.
Definition help.c:650
bool link_with_ld_simple(const char *obj_filename, const char *exe_filename)
Alternative simpler linking approach using system()
Definition help.c:677
bool link_object_files(const char *output_dir, const char *executable_name, int opt_level, bool is_debug, CodeGenContext *ctx)
Definition run.c:248
bool run_formatter(BuildConfig config, ArenaAllocator *allocator)
Definition help.c:166
bool validate_module_system(CodeGenContext *ctx)
int print_help()
Prints help message describing usage and options.
Definition help.c:80
double timer_get_elapsed_ms(CompileTimer *timer)
Definition help.c:780
const char * read_file(const char *filename)
Reads entire file content into a newly allocated buffer.
Definition help.c:50
int print_version()
Prints version information.
Definition help.c:124
bool run_build(BuildConfig config, ArenaAllocator *allocator)
Definition run.c:450
void print_progress_with_time(int step, int total, const char *stage, CompileTimer *timer)
Definition help.c:785
bool PathExist(const char *p)
Definition help.c:152
bool check_argc(int argc, int expected)
Checks if the number of command-line arguments is at least expected.
Definition help.c:34
void timer_start(CompileTimer *timer)
Definition help.c:772
Arena allocator structure.
Definition memory.h:101
Configuration structure to hold build options parsed from CLI.
Definition help.h:48
bool format_check
Definition help.h:56
GrowableArray files
Definition help.h:61
bool check_mem
Definition help.h:54
int opt_level
Definition help.h:63
GrowableArray tokens
Definition help.h:65
bool format_in_place
Definition help.h:57
bool is_document
Definition help.h:59
const char * target_os
Definition help.h:51
const char * filepath
Definition help.h:49
bool lsp_mode
Definition help.h:58
bool save
Definition help.h:52
bool is_debug
Definition help.h:60
bool format
Definition help.h:55
size_t file_count
Definition help.h:62
bool clean
Definition help.h:53
size_t token_count
Definition help.h:66
const char * name
Definition help.h:50
clock_t end_time
Definition help.h:71
clock_t start_time
Definition help.h:70
double elapsed_ms
Definition help.h:72
Growable array backed by an arena allocator.
Definition memory.h:112
Represents a single token extracted by the lexer.
Definition lexer.h:151