Build & Run
Build cnegc from source or use an existing binary. Covers prerequisites, build systems, all compiler commands, and the lexer benchmark.
Using a prebuilt binary
| Command | Needs Clang? | Output |
|---|---|---|
cnegc check <file> | No | diagnostics only |
cnegc ir <file> | No | typed IR text |
cnegc llvm-ir <file> | No | LLVM IR text |
cnegc obj <file> [out] | Yes | .o object file |
cnegc build <file> [out] | Yes | linked binary |
cnegc bench-lexer <file> N | No | timing output |
Build from source
Prerequisites
- A C compiler available as
cc(for Make) or any C compiler (for CMake) makeor CMake 3.20+clang-18orclanginPATHfor the full test suitebashformake testpython3only if you want the optional blocking TCP or UDP integration tests
With make
shell
make # produces build/cnegc
make test # runs the full test suite
make net-test # optional Python-based std.net integration test
make udp-test # optional Python-based std.net UDP integration testWith CMake
shell
cmake -S . -B out
cmake --build out # produces out/build/cnegc
ctest --test-dir out --output-on-failureIf Python 3 is available:
shell
cmake --build out --target net-test
cmake --build out --target udp-testllvm-as is optional
Smoke tests use llvm-as-18 or llvm-as when available, and fall back to clang -c -x ir otherwise.
Project rule: line cap
No source file may exceed 3 000 lines. Run make check-lines to verify before committing.
Current compiler checkpoints
checkruns lexing, parsing, semantic analysis, and diagnosticsirdumps typed IR after simple optimization and constant foldingllvm-irshows the backend-ready LLVM text formobjandbuilduse the hostclangdriver after LLVM text generation
optional network integration
make test and the default CMake/CTest path stay deterministic and do not launch multi-process network binaries. Use make net-test / cmake --build out --target net-test for the real blocking TCP server/client integration check, or make udp-test / cmake --build out --target udp-test for the UDP path.