Skip to content

Aiur interpreter#370

Merged
gabriel-barrett merged 8 commits intomainfrom
aiur-interpreter
Apr 9, 2026
Merged

Aiur interpreter#370
gabriel-barrett merged 8 commits intomainfrom
aiur-interpreter

Conversation

@gabriel-barrett
Copy link
Copy Markdown
Member

@gabriel-barrett gabriel-barrett commented Apr 8, 2026

This PR implements an interpreter of Aiur terms, used for debugging. Features

  • Early return
  • Stack trace
  • IO buffer
  • Pointer caching
  • Function call caching

@arthurpaulino arthurpaulino force-pushed the aiur-interpreter branch 2 times, most recently from 5d1a7a7 to e61a7f0 Compare April 8, 2026 21:04
gabriel-barrett and others added 6 commits April 8, 2026 21:58
Reason is that checking a term is useful whether you want to compile or not
- Kernel.lean: --dbg flag runs the interpreter instead of bytecode execution
- Interpreter: IOBuffer added to state, IO operations fully implemented,
  assertEq generalized to any Value, u8Sub returns (result, underflow) tuple,
  debug prints label and optional value
- Flatten/unflatten functions for converting between structured Values and
  flat Array G (matching bytecode layout)
- Tests/Aiur/Common.lean: every test case now also runs the interpreter and
  checks that output and IOBuffer match bytecode execution
@gabriel-barrett gabriel-barrett marked this pull request as ready for review April 9, 2026 11:18
Comment thread Ix/Aiur/Interpret.lean Outdated
Use a single `store : IndexMap (Array Value) Unit` instead of separate
`heap : Array Value` and `storeCache : Std.HashMap Value Nat` fields.
Replace derived BEq on Value with a manual DecidableEq instance (via
mutual recursion through Array/List) so that IndexMap's EquivBEq and
LawfulHashable requirements are satisfied without sorry.
@gabriel-barrett gabriel-barrett merged commit 7e123f3 into main Apr 9, 2026
14 checks passed
@gabriel-barrett gabriel-barrett deleted the aiur-interpreter branch April 9, 2026 15:39
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.

3 participants