Assembler: clean pseudo-instruction lowering, fix for comment parsing + NEG docs#29
Open
OpenSourceAnarchist wants to merge 3 commits into
Open
Conversation
OpenSourceAnarchist
commented
Apr 20, 2026
- Replaces chained pseudo-instruction conditionals with a small rewrite table.\n- Keeps existing pseudo behavior (including NEG A C -> SUB r0 A C).\n- Adds a brief pseudo-instructions section to README.\n\nBrief, no behavior expansion beyond existing support.
Comment stripping now treats // as the slash comment token instead of a single /. This prevents single-slash-prefixed lines from being silently discarded while keeping full-line and trailing // comments working as intended. I also limited each comment split to one occurrence to avoid unnecessary over-splitting, while preserving existing ; and # handling. Regression checks against the issue scenario and programs/helloworld.as produced expected output.
Author
|
Closes #28 |
There was a problem hiding this comment.
Pull request overview
Refactors pseudo-instruction lowering in the assembler into a small rewrite table and documents supported pseudo-instructions (including NEG) in the README.
Changes:
- Replaced chained pseudo-instruction conditionals with a
pseudo_instructionsrewrite table (with operand-count validation). - Updated comment stripping to prefer
//(and limited splitting to a single occurrence). - Added a README section documenting supported pseudo-instructions and their expansions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| assembler.py | Refactors pseudo-instruction lowering; updates comment delimiter handling. |
| README.md | Documents pseudo-instructions and their concrete expansions (including NEG). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This keeps the explicit // delimiter while restoring support for legacy single-slash comment stripping. Both / and // comment-prefixed lines now continue to assemble as comments, matching prior behavior and addressing the review concern. Validation covered / and // full-line comment parsing plus a regression comparison for programs/helloworld.as against the checked-in machine code.
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.