Initial commit

This commit is contained in:
ktkk 2026-01-13 19:52:23 +00:00
commit b2edca2cb4
25 changed files with 3590 additions and 0 deletions

49
CMakeLists.txt Normal file
View file

@ -0,0 +1,49 @@
cmake_minimum_required(VERSION 4.1)
project(
clox
LANGUAGES
C
)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_executable(
${PROJECT_NAME}
main.c
vm.c
chunk.c
memory.c
debug.c
value.c
compiler.c
scanner.c
object.c
table.c
)
set_target_properties(
${PROJECT_NAME}
PROPERTIES
C_STANDARD 23
C_STANDARD_REQUIRED ON
C_EXTENSIONS OFF
)
target_compile_options(
${PROJECT_NAME}
PRIVATE
-Wall -Wextra -Wpedantic
)
target_compile_definitions(
${PROJECT_NAME}
PRIVATE
$<$<AND:$<CONFIG:Debug>,$<BOOL:${PRINT_CODE}>>:DEBUG_PRINT_CODE>
$<$<AND:$<CONFIG:Debug>,$<BOOL:${TRACE_EXECUTION}>>:DEBUG_TRACE_EXECUTION>
$<$<AND:$<CONFIG:Debug>,$<BOOL:${STRESS_GC}>>:DEBUG_STRESS_GC>
$<$<AND:$<CONFIG:Debug>,$<BOOL:${LOG_GC}>>:DEBUG_LOG_GC>
)
target_compile_definitions(
${PROJECT_NAME}
PRIVATE
$<$<BOOL:${NAN_BOXING}>:NAN_BOXING>
)