Skip to content

Compile structs in LLVM backend#12

Merged
mtmatt merged 12 commits into
mainfrom
feat/llvm-compiler
Jun 10, 2026
Merged

Compile structs in LLVM backend#12
mtmatt merged 12 commits into
mainfrom
feat/llvm-compiler

Conversation

@mtmatt

@mtmatt mtmatt commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Summary:

  • add LLVM codegen/runtime support for Struct definitions and struct method attachment
  • support compiled struct methods with self binding and destructor cleanup parity
  • remove tracked pseudoc binary and ignore future local builds

Tests:

  • make compiler
  • make test-compiler
  • make test

mtmatt and others added 12 commits June 10, 2026 20:12
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…m_this on Value

Groundwork for the LLVM compiler runtime: compiled code needs to recover
shared_ptr ownership from raw Value pointers, reuse builtin/method execute
paths with pre-evaluated arguments, and expand imports outside run().

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
extern "C" rt_* shims over the existing Value/SymbolTable machinery, with
arena-frame lifetime tracking and a CompiledAlgoValue that bridges native
function pointers into the interpreter's call protocol. Runtime errors print
the interpreter's top-level message and exit(1).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Lowers the AST to LLVM IR with all operations dispatched to the rt_* runtime,
optimizes at O2, emits a native object file, and links it against
libpseudort.a. Loops get per-iteration arena frames; for-loops keep the
latest loop variable alive in a dedicated frame.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Shares the interpreter's is_memoizable_numeric_algo analysis (now in
src/analysis.h) so compiled recursive numeric algorithms get the same
by-argument caching. Documents the compile workflow in the README and makes
the clang-tidy CI script tolerate missing LLVM headers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… files

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mtmatt
mtmatt merged commit b419685 into main Jun 10, 2026
2 checks passed
@mtmatt
mtmatt deleted the feat/llvm-compiler branch June 10, 2026 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant