Skip to content

Assembler: clean pseudo-instruction lowering, fix for comment parsing + NEG docs#29

Open
OpenSourceAnarchist wants to merge 3 commits into
mattbatwings:mainfrom
OpenSourceAnarchist:fix/neg-pseudoinstruction
Open

Assembler: clean pseudo-instruction lowering, fix for comment parsing + NEG docs#29
OpenSourceAnarchist wants to merge 3 commits into
mattbatwings:mainfrom
OpenSourceAnarchist:fix/neg-pseudoinstruction

Conversation

@OpenSourceAnarchist

Copy link
Copy Markdown
  • 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.
@OpenSourceAnarchist OpenSourceAnarchist marked this pull request as ready for review April 22, 2026 23:13
Copilot AI review requested due to automatic review settings April 22, 2026 23:13
@OpenSourceAnarchist OpenSourceAnarchist changed the title Assembler: clean pseudo-instruction lowering + NEG docs Assembler: clean pseudo-instruction lowering, fix for comment parsing + NEG docs Apr 22, 2026
@OpenSourceAnarchist

Copy link
Copy Markdown
Author

Closes #28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_instructions rewrite 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.

Comment thread assembler.py Outdated
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.
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.

2 participants