Skip to content

Conversation

@dylon
Copy link
Collaborator

@dylon dylon commented Dec 27, 2025

Summary

Add module system infrastructure:

  • Package info parsing (metta.toml)
  • Module dependency tracking
  • Import/export management

Part of Stacked PR Series

This is PR #11 in a 28-PR stacked series implementing the bytecode VM and JIT compiler.
Base: pr10/metta-value-state-memo-empty
Next: pr12/space-handle


This PR series implements tiered compilation: tree-walker → bytecode VM → JIT native code

@dylon dylon force-pushed the pr10/metta-value-state-memo-empty branch from ad0279f to 7abe780 Compare December 27, 2025 03:57
@dylon dylon force-pushed the pr11/modules-system branch from e6af863 to 7ce4d82 Compare December 27, 2025 03:58
@dylon dylon force-pushed the pr10/metta-value-state-memo-empty branch from 7abe780 to 399590b Compare December 27, 2025 06:49
dylon and others added 3 commits December 27, 2025 01:51
Add mork_bridge.rs (~412 lines):
- Bridge between bytecode VM and MORK/Environment for rule dispatch
- Rule compilation caching with hash-based keys
- Pattern specificity calculation for rule ordering
- Stats tracking for cache hit/miss monitoring

Add cache.rs (~309 lines):
- LRU-based bytecode compilation cache
- can_compile result caching for compilability checks
- Fast inline hashing for primitives (Long, Bool, Nil, Float)
- SIMD-accelerated gxhash for complex types (SExpr, Atom, String)

Add gxhash dependency for fast hashing.
Add Rule::new() constructor for test compatibility.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add comprehensive module system for HE-compatible package management:

- Module submodules:
  - cache.rs: Module caching with content-based hashing
  - loader.rs: Module loading with dependency resolution
  - metta_mod.rs: MettaMod structure for module metadata
  - module_space.rs: Layered space with module dependencies
  - package.rs: Package manifest parsing (metta.toml)
  - path.rs: Module path resolution (self:, top: prefixes)
  - pkg_info_metta.rs: _pkg-info.metta parser for HE format
  - tokenizer.rs: Per-module tokenization with shadowing

- Grammar updates for HE compatibility:
  - Add space_reference token for &self, &kb patterns
  - Updated identifier pattern using blacklist approach
  - Support #-prefixed symbols for package info format
  - Add !=, >=, <= comparison operators

- Eval updates:
  - match now supports both (match &self ...) and (match & self ...)
  - Backward-compatible with old 4-arg format

Dependencies added: serde, toml, semver for package parsing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@dylon dylon force-pushed the pr11/modules-system branch from 7ce4d82 to eb2d3e6 Compare December 27, 2025 06:56
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.

2 participants