Skip to content

v1 Milestone - Complete single file language#8

Merged
jackwthake merged 15 commits into
mainfrom
feat/missing-code-generation
Jul 1, 2026
Merged

v1 Milestone - Complete single file language#8
jackwthake merged 15 commits into
mainfrom
feat/missing-code-generation

Conversation

@jackwthake

Copy link
Copy Markdown
Owner

Reaches the v1.0 milestone from docs/roadmap.md: every must-have and
should-have feature for a "complete single-file language" is implemented and
tested. Only explicitly-optional nice-to-haves remain (short-circuit &&/||
outside boolean context, &=/|=/^=/<<=/>>= compound assignment).

Language features

  • break / continue for while and for loops, with analyzer checks
    rejecting either outside a loop.
  • Local string literal initializers: u8 *p = "..."; now works inside
    function bodies, not just at global scope.
  • 16-bit multiply/divide/modulo (__mul16, __div16, __sdiv16).
  • __heap_start / __memory_top implicit compiler globals for bump
    allocators and RAM-top queries.
  • Embedded ROM symbol table ("C02S") so c02-objdump resolves real
    function names instead of auto-generated labels; --strip-debug to omit it.

Correctness fixes

  • Variable shadowing is now a semantic error (ERR_SHADOWED_DECLARATION).
    Root cause: codegen identifies variables by bare name with no scope
    qualifier, so a shadowed inner declaration silently aliased its outer
    namesake's storage — this caused break to fire on the wrong loop
    iteration. Shadowing an enclosing scope is now rejected at analysis time;
    reuse across non-overlapping sibling scopes is unaffected.
  • Signed 8-bit div/mod (__sdiv8), i8 division/modulo was routing
    through the unsigned helper and producing wrong results for negative
    operands.
  • Binary op widening/signedness: mixed-width and mixed-sign binary ops
    derived type/signedness from the left operand only, causing dropped high
    bytes (u8 + u16) and trichotomy violations in comparisons (i8 < u8 vs
    u8 < i8 disagreeing). Both operands now normalize to a common type before
    the op.

Safety / robustness

  • ROM overflow detection: all ROM writes are now bounds-checked; a
    program exceeding 32 KB fails with a diagnostic instead of silently
    corrupting the output.
  • ZP map overflow propagation: zero-page exhaustion now fails codegen
    cleanly instead of printing a warning and continuing.

@jackwthake jackwthake merged commit f201919 into main Jul 1, 2026
6 checks passed
@jackwthake jackwthake deleted the feat/missing-code-generation branch July 1, 2026 16:57
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.

1 participant