fix: add appropriate A instruction value constraints#634
Open
mmatsumoto1026 wants to merge 1 commit intonand2tetris:mainfrom
Open
fix: add appropriate A instruction value constraints#634mmatsumoto1026 wants to merge 1 commit intonand2tetris:mainfrom
mmatsumoto1026 wants to merge 1 commit intonand2tetris:mainfrom
Conversation
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.
Closes: #631
This PR was opened to add appropriate A instruction value constraints so that web-ide's Assembler makes A instruction with invalid value disable to translate into binary machine code.
For
@-1instructionWith referencing the Ohm-js documentation, aInstruction grammar in asm.ohm.js and asm.ohm are changed from
decNumbertodigit+.For
@32768instructionIn
Afunction of asm.ts, too large invalid value of A instruction detected and then throw an error message which will be showed in StatusLine footer.The code was tested locally as described in following.
@-1,@32768in the editor of web-ide's Assembler and confirm that the assembly code cause a syntax error, show the error message, and can not translate them into binary machine code.Unit tests are also added, which ensure the Ohm's grammar validation functionality and solving original issues.