Commit e582563
feat: implement Phase 1 — manifest, codegen pipeline, ABI types, and tests
Implement the complete atsiser Phase 1 pipeline for wrapping C codebases
in ATS2 linear types with zero-cost memory safety:
Manifest (src/manifest/mod.rs):
- [project], [[c-sources]] (path, include-dirs), [[ownership-rules]]
(function, pattern: alloc/free/borrow/transfer), [ats2] (compiler flags)
- Validation, init template generation, info display
Codegen pipeline (src/codegen/):
- parser.rs: regex-based C header parser extracting function signatures
with heuristic alloc/free/borrow pattern detection
- ats_gen.rs: generates ATS2 viewtype wrappers (.sats/.dats) from parsed
C signatures and ownership rules, with proof obligations
- compiler.rs: constructs patsopt/patscc commands for ATS2 compilation
ABI types (src/abi/mod.rs):
- OwnershipPattern, Viewtype (standard/nullable/sized), LinearPtr,
MemorySafetyProof (alloc/free/borrow/bounds/null-check), ATSModule,
ATSFunction, ATSParam — with ATS2 source generation
Tests: 32 unit tests + 12 integration tests covering manifest round-trip,
C header parsing, ownership detection, module generation, code rendering,
compiler commands, and end-to-end file generation.
Example: examples/safe-malloc/ with stdlib_subset.h and atsiser.toml.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 8bc8866 commit e582563
13 files changed
Lines changed: 3803 additions & 54 deletions
File tree
- examples/safe-malloc
- include
- src
- abi
- codegen
- manifest
- tests
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
0 commit comments