Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@ Then run the REPL:
./ouro_lang
```

A Zig build script is also included (`build.zig`) for environments with the Zig compiler installed. It now compiles the C portions of the project using the C23 standard and links against LLVM in addition to `libc`. The script mirrors the basic CMake configuration and exposes tasks for running the module example and its unit tests.
A Zig build script is also included (`build.zig`) for environments with the Zig compiler installed. It compiles the C/C++ sources using modern standards and links against LLVM. Use it to build the entire project with:

```bash
zig build
```

The script also exposes tasks for running the module example and its unit tests.

## Repository Structure

The project now includes a CMake-based build system, tests, container setup, and documentation. Run `cmake` in a `build` directory to configure and build the modules in `src/`.
The project includes a Zig-based build system, tests, container setup, and documentation. Invoke `zig build` to compile all targets.

## Zig Build with Modules

Expand All @@ -47,9 +53,14 @@ guidelines.

## Fuzzing Tools

Experimental AFL++ harnesses live in `tools/fuzz`. They can be
built with CMake using `-DENABLE_FUZZ=ON` and run against the sample
corpus in `fuzz/corpus` to discover crashes in the lexer and parser.
Experimental AFL++ harnesses live in `tools/fuzz`. You can build the
lexer fuzzer with Zig and run it against the sample corpus in
`fuzz/corpus` to discover crashes in the lexer and parser:

```bash
zig build fuzz-lexer
./zig-out/bin/fuzz_lexer -i fuzz/corpus -o findings
```


## Legacy Ouroboros Sources
Expand Down
12 changes: 4 additions & 8 deletions docs/build_system.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# Build System

The repository can be built using vanilla CMake or the Zig build
script. Typical CMake usage:
The repository is built using Zig. Compile all artifacts with:

```bash
mkdir build && cd build
cmake ..
cmake --build . -- -j$(nproc)
ctest --output-on-failure
zig build
```

The Zig file `build.zig` mirrors the above configuration and also
exposes custom steps for running the module demo:
The `build.zig` file also exposes custom steps for running the module
demo and its unit tests:

```bash
zig build mod-run
Expand Down
18 changes: 8 additions & 10 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,17 @@ fuzzing harness.

### Unit tests

```
mkdir build && cd build
cmake ..
cmake --build .
ctest --output-on-failure
Run the module test suite with:

```bash
zig build mod-test
```

### Fuzzing

If AFL++ is installed you can build the lexer fuzzer:
If AFL++ is installed you can build the lexer fuzzer using Zig:

```
cmake -DENABLE_FUZZ=ON ..
make fuzz_lexer
./fuzz_lexer -i ../fuzz/corpus -o ./findings
```bash
zig build fuzz-lexer
./zig-out/bin/fuzz_lexer -i fuzz/corpus -o findings
```
8 changes: 3 additions & 5 deletions tools/fuzz/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# Fuzzing Harness

This directory contains the AFL++ based lexer fuzzer. Building it requires CMake with `-DENABLE_FUZZ=ON`:
This directory contains the AFL++ based lexer fuzzer. Build it using Zig:

```bash
mkdir build && cd build
cmake -DENABLE_FUZZ=ON ..
make fuzz_lexer
zig build fuzz-lexer
```

Provide a seed corpus in `fuzz/corpus` and run the fuzzer:

```bash
./fuzz_lexer -i ../fuzz/corpus -o ./findings
./zig-out/bin/fuzz_lexer -i fuzz/corpus -o findings
```

Crashes will be written to the `findings` directory for investigation.
Loading