Skip to content

feat(script): add interpreter core engine (#57)#63

Merged
sgbett merged 2 commits intomasterfrom
feature/21-script-interpreter
Feb 11, 2026
Merged

feat(script): add interpreter core engine (#57)#63
sgbett merged 2 commits intomasterfrom
feature/21-script-interpreter

Conversation

@sgbett
Copy link
Owner

@sgbett sgbett commented Feb 11, 2026

Summary

Test plan

  • bundle exec rspec spec/bsv/script/interpreter/ — all 113 interpreter specs pass
  • bundle exec rubocop lib/bsv/script/interpreter/ lib/bsv/script.rb — 0 offences
  • bundle exec rake — full suite green (711 examples, 0 failures)

Closes #57

🤖 Generated with Claude Code

sgbett and others added 2 commits February 11, 2026 01:36
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implements Phase 1 (#57) of the script interpreter (#21):

- ScriptError with 23 typed error codes (symbols)
- ScriptNumber: LE sign-magnitude encoding/decoding, arbitrary-precision
  arithmetic (truncated-toward-zero division, dividend-sign modulo),
  minimal encoding validation, minimally_encode for padding removal
- Stack: FORTH-like operations (dup_n, drop_n, rot_n, swap_n, over_n,
  pick_n, roll_n, nip_n, tuck), Bitcoin consensus boolean encoding
  (negative zero = false), type-converting push/pop for bytes/ints/bools
- Interpreter skeleton with evaluate/verify class methods

Closes #57

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

❌ Patch coverage is 97.29730% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
lib/bsv/script/interpreter/script_number.rb 96.90% 3 Missing ⚠️
lib/bsv/script/interpreter/stack.rb 96.66% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@sgbett sgbett merged commit 78c868c into master Feb 11, 2026
1 of 7 checks passed
@sgbett sgbett deleted the feature/21-script-interpreter branch February 11, 2026 18:46
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.

[Task 1] Core engine — Stack, ScriptNumber, Errors

1 participant