feat(script): add interpreter core engine (#57)#63
Merged
Conversation
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 Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ScriptErrorwith 23 typed error codes,ScriptNumberwith LE sign-magnitude encoding and arbitrary-precision arithmetic,Stackwith FORTH-like operations and Bitcoin consensus boolean encoding, andInterpreterskeleton withevaluate/verifyclass methodsTest plan
bundle exec rspec spec/bsv/script/interpreter/— all 113 interpreter specs passbundle exec rubocop lib/bsv/script/interpreter/ lib/bsv/script.rb— 0 offencesbundle exec rake— full suite green (711 examples, 0 failures)Closes #57
🤖 Generated with Claude Code