|
- COMMODORE 128 - LANGUAGE AND COMPILER PROJECT
-
- Nova128
- Language Reference
- and Implementation Status
- What the language is today, what is proven, and what remains
-
- Repository snapshot
- November 20, 2026
- Target: Commodore 128 native 8502 mode
- Compiler: on-machine ca65 assembly implementation
-
- NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
-
- Snapshot: 2026-11-20
-
- Contents
- Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
- Executive summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
- What this document means by implemented . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
-
- 1. Language profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
- Version 1 at a glance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
- Deliberately excluded from version 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
- Source and file conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
-
- 2. Lexical syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
- Tokens and literals
-
- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6
-
- Operators and punctuation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
- Line discipline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
-
- 3. Types, values, and conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
- Primitive representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
- Reference representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
- Implicit conversion rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
- Numeric operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
- Fixed-size arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
-
- 4. Program structure and declarations
-
- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8
-
- Declaration rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
- Constructor and destructor shapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
-
- 5. Classes, interfaces, and lifetime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
- Object behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
- Object layout contract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
- Interface declaration and conformance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
- Dispatch model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
- Explicit lifetime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
-
- 6. Statements and expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
- Statement forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
- Expression precedence, highest to lowest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
- Current semantic coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
-
- 7. Complete language example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
- What the compiler must eventually emit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
- What is runnable now . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
-
- Repository-based technical documentation
-
- Page 2
-
- NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
-
- Snapshot: 2026-11-20
-
- 8. Diagnostics and resource limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
- Diagnostic contract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
- Verified limits in this snapshot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
-
- 9. Compiler architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
- Execution boundary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
- Three-pass design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
- Memory strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
- Banking and KERNAL discipline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
-
- 10. Implementation status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
- 11. Current verification evidence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
- Current audit caveat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
- Planning progress by epic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
-
- 12. What needs to be worked on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
- Priority 1 - close the source-to-code gaps left by E04 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
- Priority 2 - finish arrays and bounds behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
- Priority 3 - implement interface polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
- Priority 4 - produce the real compiler application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
-
- 13. Integration, hardening, and release work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
- Editor and compiler workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
- Regression and release . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
- Recommended milestone sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
-
- 14. Open decisions and risks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
- Scope guardrails . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
-
- Section 15 - Current practical workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
- Front-end edit/check demonstration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
- Current end-to-end code-generation demonstration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
- What does not work yet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
- Safe disk rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
-
- Appendix A - Source documents reviewed
-
- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
-
- Snapshot caveat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
-
- Repository-based technical documentation
-
- Page 3
-
- NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
-
- Snapshot: 2026-11-20
-
- Executive summary
- CURRENT REALITY
-
- Nova128 now has a verified C128-native front end, a bounded native-code backend,
- deterministic PRG/MAP output, and a source-compiled Counter program that runs in x128. It is
- still a development system rather than a complete version 1 compiler: arrays, general
- word-valued emission, full call arguments and frame prologues, source-level new/delete,
- interface dispatch, production workflow, and release hardening remain.
-
- Nova128 is a small, statically typed, class-based language designed to be compiled entirely on a Commodore 128. Its version
- 1 design includes explicit object lifetime, fixed-size arrays, private and public members, constructors and destructors,
- multiple interfaces, and dynamic dispatch through interface tables. The compiler itself is written in documented 8502/6502
- assembly and targets C128 native mode.
- As of this snapshot, 30 of 46 planned stories are marked done. The C128 platform layer, complete front end, procedural
- backend stories, heap, class descriptors, construction/deletion runtime, concrete-member emitter, and disposable D81
- builder all have completed claims. The remaining 16 stories are fixed arrays and bounds checks, all six interface-runtime
- stories, the final editor/compiler workflow, and the hardening/release epic.
- Measure
-
- Observed status
-
- Planning stories
-
- 30 done, 0 active, 16 not yet claimed (46 total)
-
- Front-end parser suite
-
- 42 fixtures pass; lowest observed expression stack pointer is $A7
-
- Lexer suite
-
- 10 fixtures / 1,119 tokens match golden output
-
- Source reader suite
-
- 8 checks pass, including 18,999-byte and 599-line boundaries
-
- Name table suite
-
- Exact host-model match through the 255-name capacity
-
- Diagnostics suite
-
- 73-entry stable catalog; screen and ERR behavior verified
-
- PRG/MAP writer
-
- Verified deterministic container, sections, MAP, collisions, and cleanup
-
- Runnable Nova128 programs
-
- hello.n8 proof and source-compiled counter.n8; Counter reports 15
-
- What this document means by implemented
- A feature is called verified only when implementation, a completed claim, and recorded test evidence agree. Story status is
- not the same as product completeness: several completed backend claims explicitly retain narrow limits, including a
- 255-byte code buffer, byte-centered source emission, a fixture-owned generated-program wrapper, and no integrated
- interface runtime. Those limits are reported here as remaining engineering work even when the owning story is marked
- done.
-
- Repository-based technical documentation
-
- Page 4
-
- NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
-
- Snapshot: 2026-11-20
-
- 1. Language profile
- DESIGN CENTER
-
- Predictable code, bounded memory, deterministic lifetime, readable 40-column diagnostics,
- and source that can be entered with the repository's C64 Vim clone.
-
- Version 1 at a glance
- - Target platform: Commodore 128 in native 8502 mode; no C64 or Z80 target.
- - Compilation model: one PETSCII SEQ source file produces one PRG.
- - Type system: static; boolean, byte, char, integer, word, class references, interface references, and fixed-size arrays.
- - Object model: classes, fields, methods, private/public access, optional init and destroy methods, and no class inheritance.
- - Polymorphism: multiple interfaces per class; static dispatch for concrete calls and dynamic dispatch for interface calls.
- - Memory management: explicit new/delete; the free-list heap and construction/deletion runtime are implemented as tested
- modules, but source-level emission is not integrated.
- - Toolchain: host ca65/ld65 builds the compiler, but the C128 compiler performs Nova128 parsing, checking, sizing, and
- emission.
-
- Deliberately excluded from version 1
- Class inheritance, garbage collection, reference counting, exceptions, generics, closures, reflection, method overloading,
- floating point, unrestricted inline assembly, separate compilation, and relocatable Nova128 object files are outside the
- version 1 boundary.
-
- Source and file conventions
- Rule
-
- Version 1 contract
-
- Source file
-
- PETSCII SEQ; logical lines end with carriage return ($0D)
-
- Suffix
-
- .n8
-
- Case
-
- Keywords and identifiers are case-insensitive
-
- Line model
-
- One statement or declaration per line; no expression continuation
-
- Maximum line
-
- 80 bytes
-
- Maximum source
-
- 18,999 bytes and 599 logical lines
-
- Identifier
-
- Letter first; letters, digits, or underscore; at most 16 significant characters
-
- Base name
-
- 12 characters or fewer so .n8/.err/.map fit the DOS filename limit
-
- Outputs
-
- NAME.PRG, NAME.ERR, and NAME.MAP
-
- Repository-based technical documentation
-
- Page 5
-
- NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
-
- Snapshot: 2026-11-20
-
- 2. Lexical syntax
- Tokens and literals
- Form
-
- Syntax
-
- Notes
-
- Comment
-
- // through end of line
-
- The newline remains a statement boundary
-
- Decimal
-
- 1234
-
- Digits only
-
- Hexadecimal
-
- $C000
-
- $ introduces hexadecimal
-
- Binary
-
- %10101010
-
- % introduces binary
-
- String
-
- "hello"
-
- Read-only literal; mutable string variables are deferred
-
- Character
-
- 'A'
-
- Exactly one PETSCII character or supported escape
-
- String escapes
-
- \" \\ \n \r
-
- Both newline escapes currently map to PETSCII $0D
-
- Character escapes
-
- \' \\ \n \r
-
- Exactly one resulting byte
-
- Operators and punctuation
- Reserved punctuation is ( ) [ ] , . : = + - * / < > <> <= >=. Boolean operators are the words and, or, and not;
- symbolic aliases such as && and || are not part of the language.
-
- Line discipline
- A newline is syntactic, not merely whitespace. It closes the current statement or declaration. Nova128 intentionally rejects
- multiple statements on one line and rejects expressions continued onto a following line. This simplifies on-machine parsing
- and improves recovery after an error.
-
- COMPATIBILITY
- NOTE
-
- The lexer accepts both PETSCII letter ranges $41-$5A and $C1-$DA and normalizes them for
- comparison. Diagnostics and map output preserve the spelling of the first declaration.
-
- Repository-based technical documentation
-
- Page 6
-
- NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
-
- Snapshot: 2026-11-20
-
- 3. Types, values, and conversions
- Primitive representation
- Type
-
- Size
-
- Range / meaning
-
- boolean
-
- 1 byte
-
- false (0) or true (1)
-
- byte
-
- 1 byte
-
- 0 through 255
-
- char
-
- 1 byte
-
- One PETSCII byte
-
- integer
-
- 2 bytes
-
- Signed two's-complement -32768 through 32767
-
- word
-
- 2 bytes
-
- Unsigned 0 through 65535
-
- Reference representation
- Value
-
- Logical size
-
- Meaning
-
- Class reference
-
- 2 bytes
-
- Object address or null
-
- Interface reference
-
- 4 bytes
-
- Object pointer plus interface-table pointer, or null
-
- String literal
-
- Length/address pair
-
- Generated read-only data; not a mutable variable type
-
- Implicit conversion rules
- - byte widens to word or integer.
- - word and integer do not mix implicitly.
- - char does not silently become text or a number.
- - boolean never converts implicitly to or from a numeric type.
- - a class reference converts to an implemented interface reference.
- - an interface reference does not down-cast to a class in version 1.
- - null is assignable to any class or interface reference.
-
- Numeric operations
- Arithmetic uses the operand type after permitted widening. Runtime overflow wraps in the destination representation.
- Literal-only arithmetic is folded by the current semantic checker; a folded value that does not fit is rejected. Division by zero
- is a compile-time diagnostic for a constant expression and is planned to use the runtime fault path otherwise.
-
- Fixed-size arrays
- Arrays use type[length], require a positive compile-time length, and are zero-based. They may be fields or locals only.
- Arrays are not parameters, results, or whole assignable values; indexing is the supported access path. Constant indexes are
- checked at compile time. Runtime bounds checking is still backend/runtime work.
-
- Repository-based technical documentation
-
- Page 7
-
- NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
-
- Snapshot: 2026-11-20
-
- 4. Program structure and declarations
- A source file contains zero or more interface declarations, zero or more class declarations, and exactly one program
- declaration. Top-level declarations may refer to types declared later in the file.
- file
-
- = { interface-decl | class-decl }, program-decl, EOF
-
- interface-decl = "interface", name, EOL,
- { method-signature },
- "end", "interface", EOL
- class-decl
-
- = "class", name, [ "implements", type-list ], EOL,
- { field-decl | method-decl },
- "end", "class", EOL
-
- program-decl
-
- = "program", name, EOL,
- { variable-decl | statement },
- "end", "program", EOL
-
- method-decl
-
- = [ access ], "method", name, "(", [ parameters ], ")",
- [ "as", type ], EOL,
- { variable-decl }, { statement },
- "end", "method", EOL
-
- field-decl
- variable-decl
- access
-
- = [ access ], type, name, EOL
- = "var", name, "as", type, EOL
- = "public" | "private"
-
- Declaration rules
- - Fields default to private; methods default to public.
- - Local variables must precede executable statements in a method.
- - A method omits as type when it returns no value.
- - A returning method must return a compatible value on every path.
- - Fields and methods occupy separate namespaces within a class.
- - Parameters and locals share a method-local namespace.
- - Top-level class and interface names share one type namespace.
-
- Constructor and destructor shapes
- The optional constructor is named init. A class may declare at most one. It takes ordinary parameters but returns no value.
- The optional destructor is named destroy; it takes no explicit parameters and returns no value.
-
- Repository-based technical documentation
-
- Page 8
-
- NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
-
- Snapshot: 2026-11-20
-
- 5. Classes, interfaces, and lifetime
- Object behavior
- Every instance method has an implicit self reference. An unqualified name resolves to a parameter or local first, then to a
- field in the enclosing class. A local or parameter may shadow a field; self.field explicitly selects the field.
-
- Object layout contract
- +0 class descriptor pointer (2 bytes)
- +2 first field, in declaration order
- ... remaining fields, with no hidden alignment padding
-
- The front end already computes and verifies this layout. ABI sizes are 1 byte for boolean/byte/char, 2 bytes for
- integer/word/class references, 4 bytes for interface references, and element-size times length for arrays. A class larger than
- 65,535 bytes is rejected.
-
- Interface declaration and conformance
- Interfaces contain method signatures only. A class names one or more contracts with implements. A method satisfies a
- requirement only when it is public and its case-insensitive name, parameter count, parameter types, and return type match
- exactly. One method may satisfy identical requirements from several interfaces. Incompatible same-name requirements are
- rejected because version 1 has no overloading.
-
- Dispatch model
- Call site type
-
- Dispatch
-
- Concrete class reference
-
- Static direct call to the known method
-
- Interface reference
-
- Dynamic lookup through the class's table for that interface
-
- Explicit lifetime
- - new Class(args) allocates zeroed storage, installs the descriptor, and calls init.
- - delete reference calls destroy when present and then releases the full object.
- - delete null is a no-op.
- - deleting through an interface uses the underlying object and class descriptor.
- - reference copies do not maintain an ownership count; use-after-delete remains a program error.
-
- IMPLEMENTATION
- BOUNDARY
-
- Layout and interface conformance are verified in the front end. The heap, object descriptors,
- construction/deletion routines, field emitter, and concrete-call emitter are implemented and
- tested independently. Source-level new/delete and the complete interface-table, conversion,
- and dynamic-dispatch path are not implemented.
-
- Repository-based technical documentation
-
- Page 9
-
- NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
-
- Snapshot: 2026-11-20
-
- 6. Statements and expressions
- Statement forms
- Statement
-
- Shape / rule
-
- Assignment
-
- target = expression
-
- Call
-
- expression.method(arguments)
-
- Conditional
-
- if expression ... [else ...] end if
-
- While loop
-
- while expression ... end while
-
- For loop
-
- for name = start to end [step value] ... end for
-
- Return
-
- return [expression]
-
- Print
-
- print expression
-
- Delete
-
- delete expression
-
- Conditions must have type boolean; numeric values are not truth values. and and or short-circuit from left to right. A for
- loop evaluates its end and step expressions once before the first iteration.
-
- Expression precedence, highest to lowest
- Level
-
- Operators / forms
-
- Associativity
-
- 1
-
- parentheses, member access, calls, indexing
-
- postfix / grouping
-
- 2
-
- not, unary -
-
- right-nesting
-
- 3
-
- */
-
- left
-
- 4
-
- +-
-
- left
-
- 5
-
- < <= > >=
-
- left
-
- 6
-
- = <>
-
- left
-
- 7
-
- and
-
- left, short-circuit
-
- 8
-
- or
-
- left, short-circuit
-
- Current semantic coverage
- The two-pass front end parses every statement form and all precedence levels. It checks assignments, arguments, returns,
- conditions, loop expressions, printing, deletion, indexing, access control, member chains, array restrictions, implicit
- conversions, and interface conformance. Expression nesting is bounded; exceeding 16 counted levels reports a resource
- diagnostic.
-
- Repository-based technical documentation
-
- Page 10
-
- NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
-
- Snapshot: 2026-11-20
-
- 7. Complete language example
- This example is valid according to the approved version 1 language. The current front end can analyze it, but the complete
- example cannot yet become a runnable PRG because source-level construction, word-valued method bodies and arguments,
- concrete-to-interface conversion, dynamic dispatch, and delete-through-interface are unfinished.
- interface Printable
- method print()
- end interface
- interface Resettable
- method reset()
- end interface
- class Counter implements Printable, Resettable
- private word value
- public method init(start as word)
- self.value = start
- end method
- public method increment()
- self.value = self.value + 1
- end method
- public method print()
- print self.value
- end method
- public method reset()
- self.value = 0
- end method
- end class
- program Main
- var count as Counter
- var output as Printable
- count = new Counter(10)
- count.increment()
- output = count
- output.print()
- delete output
- end program
-
- What the compiler must eventually emit
- - A Counter descriptor containing its instance size and destructor metadata.
- - A Printable method table and a Resettable method table for Counter.
- - Heap allocation and descriptor initialization for new Counter(10).
- - A direct call for count.increment().
- - A concrete-to-interface conversion for output = count.
- - An indirect interface call for output.print().
- - Destructor lookup and free-list return for delete output.
-
- Repository-based technical documentation
-
- Page 11
-
- NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
-
- Snapshot: 2026-11-20
-
- What is runnable now
- The current end-to-end backend compiles counter.n8, a byte-local loop program, into deterministic PRGs with final section
- addresses and runs it in x128 with result 15. A separate bounded hello.n8 fixture emits and displays one string literal. These
- are real milestones, but they do not yet exercise the complete object/interface example above.
-
- 8. Diagnostics and resource limits
- Diagnostic contract
- Compile-time diagnostics use stable E-codes, a source name, a line, a column, and a compact message. The screen form is
- limited to a 40-column-safe two-line display. The full list is written to NAME.ERR. After 20 errors, the compiler emits the limit
- diagnostic and stops cleanly.
- E014 TEST.N8 23 7
- BYTE EXPECTED; WORD FOUND
-
- Category
-
- Examples
-
- Lexical
-
- Invalid character, malformed literal, long identifier
-
- Syntax
-
- Expected token, premature line end, missing block terminator
-
- Names
-
- Duplicate declaration, unknown name, table capacity
-
- Types
-
- Mismatch, illegal conversion, invalid index, missing return
-
- Objects
-
- Private access, invalid lifecycle signature, oversize class
-
- Interfaces
-
- Missing/private method, signature mismatch, conflict, wrong kind
-
- I/O
-
- Cannot read source, cannot write ERR, output collision
-
- Resources
-
- Source/line limits, nesting, error limit, bounded tables
-
- Verified limits in this snapshot
- Limit
-
- Verified behavior
-
- Source bytes
-
- 18,999 accepted; larger source rejected with position
-
- Logical lines
-
- 599 accepted; line 600 rejected
-
- Line width
-
- 80 accepted; byte 81 rejected
-
- Names
-
- 255 IDs; further names produce bounded errors with guard bytes intact
-
- Expression depth
-
- Bounded at 16 counted levels
-
- Errors
-
- 20 ordinary errors plus one error-limit record
-
- Class size
-
- More than 65,535 bytes rejected as E096
-
- Repository-based technical documentation
-
- Page 12
-
- NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
-
- Snapshot: 2026-11-20
-
- 9. Compiler architecture
- Execution boundary
- The deliverable compiler is an 8502 program running in C128 native mode. Host tools may assemble and link the compiler,
- copy disk files, launch VICE, and compare results. They must not perform Nova128 parsing, type checking, or code
- generation in the release workflow.
-
- Three-pass design
- Pass
-
- Purpose
-
- Current state
-
- 1 - declarations/layout
-
- Collect types, members, signatures, field offsets, interface slots, and
- conformance
-
- Implemented and verified
-
- 2 - semantics/sizing
-
- Resolve bodies and types; size generated routines and data sections
-
- Implemented for the current
- bounded emitter; count/emit
- mismatch is checked
-
- 3 - emission
-
- Reparse deterministically; emit 8502 code, sections, PRG, and MAP
-
- Working for the current subset;
- Counter runs with final addresses
-
- Memory strategy
- Region
-
- Compiler use
-
- Bank 0
-
- Resident compiler code, control, parser state, diagnostics, disk/KERNAL wrappers
-
- Bank 1 $2000-$6AFF
-
- Whole-source cache; read once and replayed for each pass
-
- Bank 1 $6B00-$BFFF
-
- 21,760-byte window for names, types, members, parameters, and work tables
-
- COMMON $1300-$18FF
-
- MMU transitions and state required while either bank is selected
-
- Private logical zero page
-
- $02-$FF via relocated page pointer P0
-
- Software stack
-
- $B800-$BFFF for substantial compiler stacks
-
- Banking and KERNAL discipline
- Only the MMU module changes memory mappings. KERNAL calls run through wrappers that install a compatible mapping,
- perform the operation, capture status, and restore the exact compiler state. Compiler states mask IRQs and guard the NMI
- vector so RESTORE is ignored during critical compilation states.
-
- Repository-based technical documentation
-
- Page 13
-
- NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
-
- Snapshot: 2026-11-20
-
- 10. Implementation status
- STATUS MODEL
-
- Verified means the repository has implementation and passing current evidence. In progress
- means code exists but acceptance is incomplete. Planned means specified in the backlog
- without a completed implementation claim.
-
- Area
-
- State
-
- Evidence / boundary
-
- C128 platform probes
-
- VERIFIED
-
- Native PRG, MMU/common RAM, KERNAL wrapper, display/clock, and compiler memory
- map
-
- Source reader
-
- VERIFIED
-
- Whole-file bank-1 cache, exact rewind, source/line limits, missing final CR
-
- Lexer
-
- VERIFIED
-
- PETSCII normalization, tokens, literals, comments, operators, exact positions
-
- Name interning
-
- VERIFIED
-
- Case folding, first spelling, collisions, 255-name bounded table
-
- Diagnostics
-
- VERIFIED
-
- 73 catalog entries, 40-column form, ERR writer, 20-error limit
-
- Declarations/scopes
-
- VERIFIED
-
- Types, members, parameters, locals, ordering, duplicate checks, access
-
- Statements/expressions
-
- VERIFIED
-
- All version 1 forms, precedence, recovery, nesting bound
-
- Type checking
-
- VERIFIED
-
- Conversions, calls, returns, operators, arrays, constant folding
-
- Class layout
-
- VERIFIED
-
- Descriptor prefix, field offsets, size calculation, overflow diagnostic
-
- Interface conformance
-
- VERIFIED
-
- Stable slots, exact signatures, conflicts, access, wrong-kind errors
-
- Disposable D81 builder
-
- VERIFIED
-
- Copies the Vim image and injects artifacts without changing the original
-
- PRG/MAP container
-
- VERIFIED
-
- Load header, BASIC 7 stub, ordered sections, MAP, collision refusal, failure cleanup
-
- Frames and scalar codegen
-
- VERIFIED
-
- Software frames, arithmetic helpers, bounded emitter, golden 231-byte stream
-
- Control flow and sizing
-
- VERIFIED
-
- Short/long branches, calls/returns, count mode, final addresses, deterministic PRGs
-
- Source-driven emission
-
- IN PROGRESS
-
- Counter runs; current path remains byte-centered with restricted calls, for loops, frames,
- and 255-byte routines
-
- Print and runtime faults
-
- VERIFIED
-
- All scalar printers plus R001-R005; hello.n8 bounded proof runs
-
- Heap and object runtime
-
- VERIFIED
-
- Free list, descriptors, new/delete routines, fields, and concrete-call primitives tested
-
- Fixed arrays/bounds
-
- PLANNED
-
- Front-end rules exist; generated indexing and runtime bounds faults are E05-S05
-
- Production compiler driver
-
- PLANNED
-
- No final N128C.PRG command loop that compiles arbitrary supported programs
-
- Interface dispatch runtime
-
- PLANNED
-
- No indirect-call trampoline or emitted implementation tables yet
-
- Integrated workflow/release
-
- PLANNED
-
- Launchers, end-to-end walkthrough, regression hardening, and release media remain
-
- Repository-based technical documentation
-
- Page 14
-
- NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
-
- Snapshot: 2026-11-20
-
- 11. Current verification evidence
- The table summarizes the latest completed claim evidence recorded in the repository through November 10, 2026, audited
- against the November 20 working tree. The current audit also rebuilt the Counter fixture and observed it reach the mailbox
- before the shared test helper timed out while asking x128 to exit; that cleanup defect is reported as harness work rather than
- treated as a language failure.
- Suite
-
- Result
-
- Source reader
-
- PASS - 8 checks, including 18,999 bytes, 599 lines, 80-byte line, missing source, and exact rewind
-
- Lexer
-
- PASS - 10 fixtures, 6,733-byte dump, exact golden-token match
-
- Names
-
- PASS - 2,217-byte dump matches host model; 255-name capacity; guards intact
-
- Parser/semantic
-
- PASS - 42 fixtures; accepted/rejected forms, exact diagnostics, layouts, interface slots, and one-error unresolved
- reference
-
- Diagnostics
-
- PASS - 73-entry catalog in sync; screen and ERR files match
-
- PRG/MAP writer
-
- PASS - 133-byte fixture PRG, exact MAP, executable startup, collision preservation, and abort/order cleanup
-
- Frames/scalar/control
-
- PASS - recursion, overflow guard, 231-byte scalar golden, short/long branches, nested control and calls
-
- Print/faults/Hello
-
- PASS - all scalar forms, R001-R005, mapping preservation, 118-byte HELLO.PRG displays text
-
- Source-compiled Counter
-
- PASS in completed claim - 175 code bytes, zero sizing mismatches, byte-identical PRGs, result 15
-
- Heap/classes/objects
-
- PASS - allocation/coalescing/exhaustion, descriptor/MAP records, init/destroy/delete, independent fields
-
- Current audit caveat
- A November 20 spot-check of verify-counter-test.ps1 built the current sources and reached the test mailbox, then
- failed in cleanup with x128 did not exit. The helper waits ten seconds after sending the remote-monitor quit command.
- The repository's completed claim evidence remains the latest full Counter acceptance run; E08-S01 should make emulator
- startup, shutdown, timeout, and artifact recovery robust enough that a cleanup failure cannot obscure a completed test.
-
- DO NOT
- OVERSTATE
-
- Counter proves native code generation for a bounded procedural subset. It does not prove
- arbitrary version 1 programs, source-level object lifetime, arrays, interface conversions or calls,
- general method arguments/results, or a production N128C.PRG user workflow.
-
- Repository-based technical documentation
-
- Page 15
-
- NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
-
- Snapshot: 2026-11-20
-
- Planning progress by epic
- Epic
-
- Done
-
- Active
-
- Remaining
-
- E00 - specification
-
- 3
-
- 0
-
- 0
-
- E01 - C128 foundation
-
- 5
-
- 0
-
- 0
-
- E02 - source/lexer/names/diagnostics
-
- 4
-
- 0
-
- 0
-
- E03 - parser and semantic model
-
- 6
-
- 0
-
- 0
-
- E04 - procedural code generation
-
- 7
-
- 0
-
- 0
-
- E05 - classes and heap
-
- 4
-
- 0
-
- 1
-
- E06 - interfaces and dispatch
-
- 0
-
- 0
-
- 6
-
- E07 - Vim/disk workflow
-
- 1
-
- 0
-
- 3
-
- E08 - hardening/release
-
- 0
-
- 0
-
- 6
-
- Total
-
- 30
-
- 0
-
- 16
-
- Repository-based technical documentation
-
- Page 16
-
- NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
-
- Snapshot: 2026-11-20
-
- 12. What needs to be worked on
- Priority 1 - close the source-to-code gaps left by E04
- - Replace the fixture-owned startup/frame setup with a production generated-program startup that initializes mapping,
- frames, runtime pointers, and clean termination.
- - Generate one- and two-byte expressions, assignments, parameters, call arguments, method results, and frame
- prologues/epilogues from source, not only from isolated emitters.
- - Lift or deliberately specify the 255-byte per-routine buffer, 64-label/128-fixup bounds, and one-byte entry-offset limits.
- - Generalize for loops beyond constant byte end and step 1, and make print support every specified scalar through the
- integrated path.
- - Integrate source-level new/delete with the proven heap and object runtime, including R005 on allocation failure.
-
- Priority 2 - finish arrays and bounds behavior
- E05-S05 is the only remaining class/heap story. It must emit local and field array addressing, handle one- and two-byte
- element sizes, prove constant and computed indexes, and route invalid runtime indexes through R002. The release/debug
- bounds-check policy also needs to be stated consistently; the front end currently checks constant indexes but no general
- array code is emitted.
-
- Priority 3 - implement interface polymorphism
- Story
-
- Required result
-
- E06-S01
-
- Freeze the four-byte interface ABI, storage rules, return convention, and clobber contract
-
- E06-S02
-
- Build a guarded indirect-call trampoline and prove nested/recursive returns
-
- E06-S03
-
- Emit per-class interface method tables and deterministic MAP records
-
- E06-S04
-
- Generate concrete-to-interface conversions for locals, fields, parameters, and returns
-
- E06-S05
-
- Generate interface slot calls with correct self, arguments, and results
-
- E06-S06
-
- Delete through interfaces; handle null and promised debug failure paths
-
- Priority 4 - produce the real compiler application
- - Assemble a production N128C.PRG command loop that accepts a source base name and orchestrates source, diagnostics,
- sizing, emission, PRG, ERR, and MAP output.
- - Freeze the generated-program memory map: code/data limits, heap base/size, software stack, runtime workspace, zero
- page, and interrupt policy.
- - Budget every compiler table inside the 21,760-byte bank-1 window and turn every overflow into a stable diagnostic.
- - Resolve the 23 currently Proposed decisions (D119-D141), especially user-visible semantics, MAP formats, and ABI choices,
- before release freeze.
-
- Repository-based technical documentation
-
- Page 17
-
- NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
-
- Snapshot: 2026-11-20
-
- 13. Integration, hardening, and release work
- Editor and compiler workflow
- The version 1 workflow deliberately keeps the C64 Vim clone separate from the C128 compiler. The remaining work is to
- provide safe sequential launchers, prove a source round-trip created entirely in Vim, and document the full
- edit/check/compile/run cycle. The same writable D81 must never be attached to x64sc and x128 at the same time.
- Story
-
- Outcome
-
- E07-S02
-
- Sequential x64sc editor and x128 compiler launchers that wait for disk flush
-
- E07-S03
-
- Vim-created PETSCII source round-trips byte-for-byte and tokenizes on the C128
-
- E07-S04
-
- User walkthrough for editing, compiling, diagnostics, collisions, and running an interface sample
-
- Regression and release
- - Automated x128 regression harness with fresh images, time limits, artifact extraction, precise failure reporting, and reliable
- emulator shutdown even after a test reaches its mailbox.
- - Golden byte/disassembly coverage for scalar code, branches, frames, objects, lifetime, conversion, and dispatch.
- - Capacity and error-path stress for every table, stack, heap, disk failure, and diagnostic limit.
- - Conformance suite mapping every normative language section to executable evidence or explicit review.
- - Reproducible compiler PRG, development D81, checksums, user guide, developer guide, and release notes.
- - Physical C128 smoke testing when hardware is available; emulator/hardware differences become tracked work.
-
- Recommended milestone sequence
- Integrated scalar/call/startup path
- -> arrays and bounds
- -> interface ABI / trampoline
- -> interface tables / conversion / calls / lifetime
- -> production N128C.PRG and editor workflow
- -> regression, conformance, release
-
- Repository-based technical documentation
-
- Page 18
-
- NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
-
- Snapshot: 2026-11-20
-
- 14. Open decisions and risks
- Topic
-
- Current position
-
- Why it matters
-
- Generated-program
- memory map
-
- Container, provisional frame stack, and fixture heap
- exist; production placement is still open
-
- Blocks a general compiler/runtime image and reliable
- capacity claims
-
- Compiler table capacities
-
- 21,760-byte bank-1 table window is frozen; final
- per-table capacities remain to be budgeted
-
- Every table must fail cleanly instead of corrupting memory
-
- Proposed decisions
-
- D119-D141 remain proposed even where behavior
- and formats are implemented
-
- Visible semantics, ABI, MAP, and capacity choices should be
- explicitly accepted before release freeze
-
- Backend limits
-
- 255 code bytes, 64 labels, 128 fixups, byte-centered
- source path, restricted calls and loops
-
- A completed story can still reject ordinary version 1
- programs with E227
-
- Interrupt behavior
-
- Compiler runs non-default mappings with IRQs
- masked; NMI is guarded
-
- Generated programs need their own final interrupt/runtime
- policy
-
- Alias lifetime
-
- No ownership counts or full lifetime proof
-
- Use-after-delete is a program error; debug detection is
- necessarily partial
-
- Hardware validation
-
- VICE x128 is mandatory; physical hardware is P2
-
- Timing or device differences may appear late
-
- Harness cleanup
-
- Current spot-check reached the mailbox but x128
- did not exit within the helper's ten-second wait
-
- E08-S01 must separate program results from emulator
- lifecycle failures
-
- Scope guardrails
- The safest path is to finish version 1's existing dependency chain before adding new syntax or runtime features. Changes to
- syntax, type rules, object layout, interface ABI, file formats, memory ownership, or supported targets require a recorded
- decision. The current design intentionally trades breadth for a compiler that can fit, diagnose, and run predictably on real
- C128 hardware.
-
- Repository-based technical documentation
-
- Page 19
-
- NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
-
- Snapshot: 2026-11-20
-
- Section 15 - Current practical workflow
- Front-end edit/check demonstration
- The repository includes a write-and-check demonstration. It copies the Vim work disk, uses x64sc to create a Nova128 file
- with the C64-mode Vim clone, then closes x64sc and uses x128 to run the Nova128 front-end checker. Valid input reports no
- errors; invalid input produces stable E-codes and a NAME.ERR file.
- cd newLang
- pwsh -File scripts/demo-write-check.ps1
-
- Current end-to-end code-generation demonstration
- The Counter verifier builds the on-machine compile fixture, compiles counter.n8 twice, checks byte-identical PRGs and the
- final MAP, then runs the generated program. Its completed claim records result 15 and zero size mismatches.
- cd newLang
- pwsh -File scripts/verify-counter-test.ps1
-
- What does not work yet
- There is not yet a production N128C.PRG that accepts an arbitrary source name and emits native code for the whole version
- 1 language. The existing compile drivers are fixtures. The complete class/interface example remains blocked on integrated
- construction, general arguments and word values, arrays, interface tables/conversion/dispatch, and deletion through an
- interface. Safe editor/compiler launchers and the user walkthrough are also not finished.
-
- Safe disk rule
- NEVER MODIFY
- THE TEMPLATE
-
- The original vim/work.d81 and reference disk images are inputs. Build and test scripts must
- create writable copies under newLang/build. x64sc and x128 must not share the same writable
- image concurrently.
-
- Repository-based technical documentation
-
- Page 20
-
- NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
-
- Snapshot: 2026-11-20
-
- Appendix A - Source documents reviewed
- Repository source
-
- Used for
-
- newLang/README.md
-
- Product boundary and intended editor/compiler workflow
-
- newLang/docs/decisions.md
-
- Accepted, proposed, deferred, and open decisions
-
- newLang/docs/language-spec.md
-
- Normative version 1 syntax and semantics
-
- newLang/docs/architecture.md
-
- Compiler passes, memory strategy, ABI, and runtime plan
-
- newLang/docs/memory-map.md
-
- Frozen compiler memory placement and evidence
-
- newLang/docs/diagnostics.md
-
- Generated stable diagnostic catalog
-
- newLang/planning/epics-and-stories.md
-
- Full 46-story backlog and dependencies
-
- newLang/planning/claims/*.md
-
- 30 completed claims, acceptance evidence, implementation limits, and remaining risks
-
- newLang/src/compiler/*.s
-
- Reader, lexer, names, parser, types, semantics, codegen, flow, sizing, members, diagnostics,
- disk I/O, and output
-
- newLang/tests and newLang/scripts
-
- Fixtures, golden expectations, build scripts, and x128 verifiers
-
- Snapshot caveat
- This document describes the working tree observed on November 20, 2026. It distinguishes completed claim evidence from
- the narrower product behavior currently demonstrated by source-driven fixtures. Future commits may change
- implementation status, test counts, diagnostics, ABI decisions, or the roadmap. Normative language behavior remains the
- repository's specification and decisions files.
-
- BOTTOM LINE
-
- Nova128 has crossed the first native-code milestone: a real source program compiles and runs.
- The next decisive work is to turn the bounded fixture path into the general version 1 compiler,
- integrate the proven object runtime, then deliver the required interface ABI and dynamic
- dispatch before workflow and release hardening.
-
- Repository-based technical documentation
-
- Page 21
-
|