Skip to content

Support split and burn handlers#44

Merged
elazarg merged 2 commits intomainfrom
split
Jan 18, 2026
Merged

Support split and burn handlers#44
elazarg merged 2 commits intomainfrom
split

Conversation

@elazarg
Copy link
Owner

@elazarg elazarg commented Dec 31, 2025

This PR significantly refactors the Vegas compiler to transition from a prototype scripting language to a structured, robust DSL for game theory. It introduces a formal ActionDag intermediate representation, explicit commit-reveal syntax, and first-class support for subgame-perfect "quit" semantics (split/burn).

Key Changes

1. Language Syntax & Design

  • Explicit Structure: Games are now encapsulated in game main() { ... } blocks, allowing for future modularity.
  • Commit-Reveal: Introduced commit and reveal keywords to explicitly model information hiding, replacing implicit inference.
  • Quit Semantics: Added split and burn keywords to declaratively handle player abandonment, replacing error-prone manual null checks in withdraw clauses.

2. Compiler & IR (ToIR.kt, IR.kt)

  • ActionDag: The compiler now lowers the AST into a dependency-based ActionDag before backend generation. This decouples game logic from execution details.
  • Payoff Desugaring: Automated generation of complex "alive" predicates and timeout logic for split/burn payoffs.
  • Let Elimination: Enforced removal of Let expressions during the lowering phase to simplify IR analysis.

3. Solidity/EVM Backend (GameToEvmIR.kt)

  • Stateless Execution: Rewrote the EVM backend to use the ActionDag linearization. Actions are now gated by immutable ACTION_ID constants rather than mutable phase counters.
  • Security: Implemented CheckReveal logic to cryptographically bind hidden values to specific roles and actions, preventing replay and copy-commit attacks.

4. Testing & Reliability

  • Golden Master Testing: Added ExamplesValidationTest.kt and copy-test-outputs.py to detect regressions in generated output (Solidity, EFG, etc.) against a known good state.
  • Semantics Formalization: Updated Semantics.kt to treat "Quit" as a first-class move in the game's transition system.

5. Documentation

  • Added SUBGAMES.md specifying conservation of money and availability rules for subgames.
  • Added AGENTS.md for AI agent context.

Signed-off-by: Elazar Gershuni <elazarg@gmail.com>
@elazarg elazarg changed the title Split Support split and burn handlers Jan 18, 2026
@elazarg elazarg merged commit 8d728dc into main Jan 18, 2026
1 check passed
@elazarg elazarg deleted the split branch January 18, 2026 10:17
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