Skip to content

Commit 69ce0f5

Browse files
committed
feat: Introduce core language infrastructure including AST, runtime objects, VM, and compiler components.
1 parent a277dbf commit 69ce0f5

35 files changed

Lines changed: 1575 additions & 537 deletions

CMakeLists.txt

Lines changed: 31 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,74 @@
1-
<<<<<<< HEAD
21
cmake_minimum_required(VERSION 3.15)
3-
project(ProXPL C)
4-
=======
5-
cmake_minimum_required(VERSION 3.13)
62
project(ProXPL)
7-
>>>>>>> feature/opcode-tests
83

94
# Enable C and C++
105
enable_language(C CXX)
116
set(CMAKE_C_STANDARD 99)
12-
<<<<<<< HEAD
137
set(CMAKE_C_STANDARD_REQUIRED ON)
8+
set(CMAKE_CXX_STANDARD 17)
9+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1410

1511
if (MSVC)
1612
add_compile_options(/W4)
1713
else()
1814
add_compile_options(-Wall -Wextra)
1915
endif()
2016

21-
# ===============================
22-
# Sources (exclude main.c)
23-
# ===============================
24-
file(GLOB_RECURSE PROX_SOURCES "src/*.c")
25-
list(REMOVE_ITEM PROX_SOURCES "${CMAKE_SOURCE_DIR}/src/main.c")
26-
27-
# ===============================
28-
# Core library (NO system libs)
29-
# ===============================
30-
add_library(prox_core STATIC ${PROX_SOURCES})
31-
target_include_directories(prox_core PUBLIC
32-
${CMAKE_SOURCE_DIR}/include
33-
${CMAKE_SOURCE_DIR}/src
34-
)
35-
36-
# ===============================
37-
# Executable (link system libs HERE)
38-
# ===============================
39-
add_executable(prox src/main.c)
40-
41-
if (UNIX)
42-
target_link_libraries(prox PRIVATE prox_core m)
43-
else()
44-
target_link_libraries(prox PRIVATE prox_core)
45-
endif()
46-
47-
# ===============================
48-
# Optional components
49-
# ===============================
50-
option(BUILD_TESTS "Build tests" OFF)
51-
option(BUILD_BENCH "Build benchmarks" OFF)
52-
53-
if (BUILD_TESTS)
54-
enable_testing()
55-
add_subdirectory(tests)
56-
endif()
57-
58-
if (BUILD_BENCH)
59-
add_subdirectory(tools/bench)
60-
=======
61-
set(CMAKE_CXX_STANDARD 17)
62-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
63-
6417
# --- LLVM Configuration ---
6518
find_package(LLVM REQUIRED CONFIG)
66-
6719
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
68-
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
69-
70-
# Include LLVM directories
7120
include_directories(${LLVM_INCLUDE_DIRS})
7221
add_definitions(${LLVM_DEFINITIONS})
73-
74-
# Link directories
7522
link_directories(${LLVM_LIBRARY_DIRS})
7623

7724
# Map generic components to specific libs
7825
llvm_map_components_to_libnames(llvm_libs core support executionengine native ipo)
7926

80-
# --- Project Source ---
8127
# Export symbols for Windows DLL
8228
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
8329

84-
# --- Project Source ---
30+
# --- Include Directories ---
8531
include_directories(include)
32+
include_directories(src)
8633

87-
# Gather sources (excluding main.c for library)
34+
# --- Library Sources ---
8835
file(GLOB_RECURSE LIB_SOURCES
8936
"src/*.c"
9037
"src/compiler/*.cpp"
9138
)
39+
# Exclude main entry point from library
9240
list(FILTER LIB_SOURCES EXCLUDE REGEX ".*main\\.c$")
9341

94-
# --- Shared Library ---
42+
# --- Core Library ---
9543
add_library(proxpl_lib SHARED ${LIB_SOURCES})
9644
target_link_libraries(proxpl_lib PRIVATE ${llvm_libs})
9745

98-
# --- Executable ---
99-
add_executable(proxpl src/main.c ${LIB_SOURCES})
100-
101-
# Link LLVM and standard libraries
102-
target_link_libraries(proxpl PRIVATE ${llvm_libs})
46+
# --- Main Executable ---
47+
add_executable(proxpl src/main.c)
48+
target_link_libraries(proxpl PRIVATE proxpl_lib ${llvm_libs})
10349

10450
if(UNIX)
10551
target_link_libraries(proxpl PRIVATE pthread dl z tinfo)
10652
target_link_libraries(proxpl_lib PRIVATE pthread dl z tinfo)
107-
>>>>>>> feature/opcode-tests
53+
endif()
54+
55+
# --- IR Test Executable ---
56+
add_executable(ir_gen_test tools/ir_gen_test.c)
57+
target_link_libraries(ir_gen_test PRIVATE proxpl_lib)
58+
59+
# --- LLVM Gen Test Executable ---
60+
add_executable(llvm_gen_test tools/llvm_gen_test.c)
61+
target_link_libraries(llvm_gen_test PRIVATE proxpl_lib ${llvm_libs})
62+
63+
# --- Optional components ---
64+
option(BUILD_TESTS "Build tests" OFF)
65+
option(BUILD_BENCH "Build benchmarks" OFF)
66+
67+
if (BUILD_TESTS)
68+
enable_testing()
69+
add_subdirectory(tests)
70+
endif()
71+
72+
if (BUILD_BENCH)
73+
add_subdirectory(tools/bench)
10874
endif()

ast.obj

18.6 KB
Binary file not shown.

bytecode_gen.obj

10.6 KB
Binary file not shown.

chunk.obj

2.13 KB
Binary file not shown.

error_report.obj

4.52 KB
Binary file not shown.

0 commit comments

Comments
 (0)