Merged
Conversation
The test passes now!
There was a problem hiding this comment.
Pull Request Overview
This PR adds an assembler for the Little Man Computer (LMC) assembly language, enabling users to write programs in assembly and compile them to machine code binary files. It also updates the Cargo dependencies and editions.
- Introduces a new
rmc_assemblebinary for assembling LMC assembly programs - Expands the
ValueAPI with methods for digit manipulation and binary serialization - Updates project documentation with instructions for assembling custom programs
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/rmc_assemble.rs | New assembler implementation with parsing, label resolution, and machine code generation |
| src/lib.rs | Adds from_digits and to_be_bytes methods to Value, makes value module public |
| src/main.rs | Reorders import statements (cosmetic change) |
| demos/add.lmc | Example LMC assembly program for demonstration |
| README.md | Updates documentation to reference the new assembler tool |
| Cargo.toml | Adds rmc_assemble binary configuration, updates edition specification |
| Cargo.lock | Updates dependency versions and lock file format version |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+48
to
+56
| pub fn from_digits(first_digit: i16, last_two_digits: i16) -> Result<Value, &'static str> { | ||
| if !(0..=9).contains(&first_digit) { | ||
| return Err("First digit out of range"); | ||
| } | ||
| if !(0..=99).contains(&last_two_digits) { | ||
| return Err("Last two digits out of range"); | ||
| } | ||
| Value::new(first_digit * 100 + last_two_digits).or(Err("Value out of range")) | ||
| } |
There was a problem hiding this comment.
The from_digits function should have documentation explaining its purpose, parameters, return value, and potential errors. For example, clarify that it constructs a value from a first digit (0-9) and last two digits (0-99) to form a three-digit number.
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.
No description provided.