Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

1480 řádky
42KB

  1. COMMODORE 128 - LANGUAGE AND COMPILER PROJECT
  2. Nova128
  3. Language Reference
  4. and Implementation Status
  5. What the language is today, what is proven, and what remains
  6. Repository snapshot
  7. November 20, 2026
  8. Target: Commodore 128 native 8502 mode
  9. Compiler: on-machine ca65 assembly implementation
  10. NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
  11. Snapshot: 2026-11-20
  12. Contents
  13. Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
  14. Executive summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
  15. What this document means by implemented . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
  16. 1. Language profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
  17. Version 1 at a glance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
  18. Deliberately excluded from version 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
  19. Source and file conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
  20. 2. Lexical syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
  21. Tokens and literals
  22. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6
  23. Operators and punctuation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
  24. Line discipline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
  25. 3. Types, values, and conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
  26. Primitive representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
  27. Reference representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
  28. Implicit conversion rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
  29. Numeric operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
  30. Fixed-size arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
  31. 4. Program structure and declarations
  32. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8
  33. Declaration rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
  34. Constructor and destructor shapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
  35. 5. Classes, interfaces, and lifetime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
  36. Object behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
  37. Object layout contract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
  38. Interface declaration and conformance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
  39. Dispatch model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
  40. Explicit lifetime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
  41. 6. Statements and expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
  42. Statement forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
  43. Expression precedence, highest to lowest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
  44. Current semantic coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
  45. 7. Complete language example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
  46. What the compiler must eventually emit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
  47. What is runnable now . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
  48. Repository-based technical documentation
  49. Page 2
  50. NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
  51. Snapshot: 2026-11-20
  52. 8. Diagnostics and resource limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
  53. Diagnostic contract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
  54. Verified limits in this snapshot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
  55. 9. Compiler architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
  56. Execution boundary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
  57. Three-pass design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
  58. Memory strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
  59. Banking and KERNAL discipline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
  60. 10. Implementation status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
  61. 11. Current verification evidence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
  62. Current audit caveat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
  63. Planning progress by epic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
  64. 12. What needs to be worked on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
  65. Priority 1 - close the source-to-code gaps left by E04 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
  66. Priority 2 - finish arrays and bounds behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
  67. Priority 3 - implement interface polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
  68. Priority 4 - produce the real compiler application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
  69. 13. Integration, hardening, and release work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
  70. Editor and compiler workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
  71. Regression and release . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
  72. Recommended milestone sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
  73. 14. Open decisions and risks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
  74. Scope guardrails . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
  75. Section 15 - Current practical workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
  76. Front-end edit/check demonstration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
  77. Current end-to-end code-generation demonstration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
  78. What does not work yet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
  79. Safe disk rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
  80. Appendix A - Source documents reviewed
  81. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
  82. Snapshot caveat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
  83. Repository-based technical documentation
  84. Page 3
  85. NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
  86. Snapshot: 2026-11-20
  87. Executive summary
  88. CURRENT REALITY
  89. Nova128 now has a verified C128-native front end, a bounded native-code backend,
  90. deterministic PRG/MAP output, and a source-compiled Counter program that runs in x128. It is
  91. still a development system rather than a complete version 1 compiler: arrays, general
  92. word-valued emission, full call arguments and frame prologues, source-level new/delete,
  93. interface dispatch, production workflow, and release hardening remain.
  94. Nova128 is a small, statically typed, class-based language designed to be compiled entirely on a Commodore 128. Its version
  95. 1 design includes explicit object lifetime, fixed-size arrays, private and public members, constructors and destructors,
  96. multiple interfaces, and dynamic dispatch through interface tables. The compiler itself is written in documented 8502/6502
  97. assembly and targets C128 native mode.
  98. As of this snapshot, 30 of 46 planned stories are marked done. The C128 platform layer, complete front end, procedural
  99. backend stories, heap, class descriptors, construction/deletion runtime, concrete-member emitter, and disposable D81
  100. builder all have completed claims. The remaining 16 stories are fixed arrays and bounds checks, all six interface-runtime
  101. stories, the final editor/compiler workflow, and the hardening/release epic.
  102. Measure
  103. Observed status
  104. Planning stories
  105. 30 done, 0 active, 16 not yet claimed (46 total)
  106. Front-end parser suite
  107. 42 fixtures pass; lowest observed expression stack pointer is $A7
  108. Lexer suite
  109. 10 fixtures / 1,119 tokens match golden output
  110. Source reader suite
  111. 8 checks pass, including 18,999-byte and 599-line boundaries
  112. Name table suite
  113. Exact host-model match through the 255-name capacity
  114. Diagnostics suite
  115. 73-entry stable catalog; screen and ERR behavior verified
  116. PRG/MAP writer
  117. Verified deterministic container, sections, MAP, collisions, and cleanup
  118. Runnable Nova128 programs
  119. hello.n8 proof and source-compiled counter.n8; Counter reports 15
  120. What this document means by implemented
  121. A feature is called verified only when implementation, a completed claim, and recorded test evidence agree. Story status is
  122. not the same as product completeness: several completed backend claims explicitly retain narrow limits, including a
  123. 255-byte code buffer, byte-centered source emission, a fixture-owned generated-program wrapper, and no integrated
  124. interface runtime. Those limits are reported here as remaining engineering work even when the owning story is marked
  125. done.
  126. Repository-based technical documentation
  127. Page 4
  128. NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
  129. Snapshot: 2026-11-20
  130. 1. Language profile
  131. DESIGN CENTER
  132. Predictable code, bounded memory, deterministic lifetime, readable 40-column diagnostics,
  133. and source that can be entered with the repository's C64 Vim clone.
  134. Version 1 at a glance
  135. - Target platform: Commodore 128 in native 8502 mode; no C64 or Z80 target.
  136. - Compilation model: one PETSCII SEQ source file produces one PRG.
  137. - Type system: static; boolean, byte, char, integer, word, class references, interface references, and fixed-size arrays.
  138. - Object model: classes, fields, methods, private/public access, optional init and destroy methods, and no class inheritance.
  139. - Polymorphism: multiple interfaces per class; static dispatch for concrete calls and dynamic dispatch for interface calls.
  140. - Memory management: explicit new/delete; the free-list heap and construction/deletion runtime are implemented as tested
  141. modules, but source-level emission is not integrated.
  142. - Toolchain: host ca65/ld65 builds the compiler, but the C128 compiler performs Nova128 parsing, checking, sizing, and
  143. emission.
  144. Deliberately excluded from version 1
  145. Class inheritance, garbage collection, reference counting, exceptions, generics, closures, reflection, method overloading,
  146. floating point, unrestricted inline assembly, separate compilation, and relocatable Nova128 object files are outside the
  147. version 1 boundary.
  148. Source and file conventions
  149. Rule
  150. Version 1 contract
  151. Source file
  152. PETSCII SEQ; logical lines end with carriage return ($0D)
  153. Suffix
  154. .n8
  155. Case
  156. Keywords and identifiers are case-insensitive
  157. Line model
  158. One statement or declaration per line; no expression continuation
  159. Maximum line
  160. 80 bytes
  161. Maximum source
  162. 18,999 bytes and 599 logical lines
  163. Identifier
  164. Letter first; letters, digits, or underscore; at most 16 significant characters
  165. Base name
  166. 12 characters or fewer so .n8/.err/.map fit the DOS filename limit
  167. Outputs
  168. NAME.PRG, NAME.ERR, and NAME.MAP
  169. Repository-based technical documentation
  170. Page 5
  171. NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
  172. Snapshot: 2026-11-20
  173. 2. Lexical syntax
  174. Tokens and literals
  175. Form
  176. Syntax
  177. Notes
  178. Comment
  179. // through end of line
  180. The newline remains a statement boundary
  181. Decimal
  182. 1234
  183. Digits only
  184. Hexadecimal
  185. $C000
  186. $ introduces hexadecimal
  187. Binary
  188. %10101010
  189. % introduces binary
  190. String
  191. "hello"
  192. Read-only literal; mutable string variables are deferred
  193. Character
  194. 'A'
  195. Exactly one PETSCII character or supported escape
  196. String escapes
  197. \" \\ \n \r
  198. Both newline escapes currently map to PETSCII $0D
  199. Character escapes
  200. \' \\ \n \r
  201. Exactly one resulting byte
  202. Operators and punctuation
  203. Reserved punctuation is ( ) [ ] , . : = + - * / < > <> <= >=. Boolean operators are the words and, or, and not;
  204. symbolic aliases such as && and || are not part of the language.
  205. Line discipline
  206. A newline is syntactic, not merely whitespace. It closes the current statement or declaration. Nova128 intentionally rejects
  207. multiple statements on one line and rejects expressions continued onto a following line. This simplifies on-machine parsing
  208. and improves recovery after an error.
  209. COMPATIBILITY
  210. NOTE
  211. The lexer accepts both PETSCII letter ranges $41-$5A and $C1-$DA and normalizes them for
  212. comparison. Diagnostics and map output preserve the spelling of the first declaration.
  213. Repository-based technical documentation
  214. Page 6
  215. NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
  216. Snapshot: 2026-11-20
  217. 3. Types, values, and conversions
  218. Primitive representation
  219. Type
  220. Size
  221. Range / meaning
  222. boolean
  223. 1 byte
  224. false (0) or true (1)
  225. byte
  226. 1 byte
  227. 0 through 255
  228. char
  229. 1 byte
  230. One PETSCII byte
  231. integer
  232. 2 bytes
  233. Signed two's-complement -32768 through 32767
  234. word
  235. 2 bytes
  236. Unsigned 0 through 65535
  237. Reference representation
  238. Value
  239. Logical size
  240. Meaning
  241. Class reference
  242. 2 bytes
  243. Object address or null
  244. Interface reference
  245. 4 bytes
  246. Object pointer plus interface-table pointer, or null
  247. String literal
  248. Length/address pair
  249. Generated read-only data; not a mutable variable type
  250. Implicit conversion rules
  251. - byte widens to word or integer.
  252. - word and integer do not mix implicitly.
  253. - char does not silently become text or a number.
  254. - boolean never converts implicitly to or from a numeric type.
  255. - a class reference converts to an implemented interface reference.
  256. - an interface reference does not down-cast to a class in version 1.
  257. - null is assignable to any class or interface reference.
  258. Numeric operations
  259. Arithmetic uses the operand type after permitted widening. Runtime overflow wraps in the destination representation.
  260. Literal-only arithmetic is folded by the current semantic checker; a folded value that does not fit is rejected. Division by zero
  261. is a compile-time diagnostic for a constant expression and is planned to use the runtime fault path otherwise.
  262. Fixed-size arrays
  263. Arrays use type[length], require a positive compile-time length, and are zero-based. They may be fields or locals only.
  264. Arrays are not parameters, results, or whole assignable values; indexing is the supported access path. Constant indexes are
  265. checked at compile time. Runtime bounds checking is still backend/runtime work.
  266. Repository-based technical documentation
  267. Page 7
  268. NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
  269. Snapshot: 2026-11-20
  270. 4. Program structure and declarations
  271. A source file contains zero or more interface declarations, zero or more class declarations, and exactly one program
  272. declaration. Top-level declarations may refer to types declared later in the file.
  273. file
  274. = { interface-decl | class-decl }, program-decl, EOF
  275. interface-decl = "interface", name, EOL,
  276. { method-signature },
  277. "end", "interface", EOL
  278. class-decl
  279. = "class", name, [ "implements", type-list ], EOL,
  280. { field-decl | method-decl },
  281. "end", "class", EOL
  282. program-decl
  283. = "program", name, EOL,
  284. { variable-decl | statement },
  285. "end", "program", EOL
  286. method-decl
  287. = [ access ], "method", name, "(", [ parameters ], ")",
  288. [ "as", type ], EOL,
  289. { variable-decl }, { statement },
  290. "end", "method", EOL
  291. field-decl
  292. variable-decl
  293. access
  294. = [ access ], type, name, EOL
  295. = "var", name, "as", type, EOL
  296. = "public" | "private"
  297. Declaration rules
  298. - Fields default to private; methods default to public.
  299. - Local variables must precede executable statements in a method.
  300. - A method omits as type when it returns no value.
  301. - A returning method must return a compatible value on every path.
  302. - Fields and methods occupy separate namespaces within a class.
  303. - Parameters and locals share a method-local namespace.
  304. - Top-level class and interface names share one type namespace.
  305. Constructor and destructor shapes
  306. The optional constructor is named init. A class may declare at most one. It takes ordinary parameters but returns no value.
  307. The optional destructor is named destroy; it takes no explicit parameters and returns no value.
  308. Repository-based technical documentation
  309. Page 8
  310. NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
  311. Snapshot: 2026-11-20
  312. 5. Classes, interfaces, and lifetime
  313. Object behavior
  314. Every instance method has an implicit self reference. An unqualified name resolves to a parameter or local first, then to a
  315. field in the enclosing class. A local or parameter may shadow a field; self.field explicitly selects the field.
  316. Object layout contract
  317. +0 class descriptor pointer (2 bytes)
  318. +2 first field, in declaration order
  319. ... remaining fields, with no hidden alignment padding
  320. The front end already computes and verifies this layout. ABI sizes are 1 byte for boolean/byte/char, 2 bytes for
  321. integer/word/class references, 4 bytes for interface references, and element-size times length for arrays. A class larger than
  322. 65,535 bytes is rejected.
  323. Interface declaration and conformance
  324. Interfaces contain method signatures only. A class names one or more contracts with implements. A method satisfies a
  325. requirement only when it is public and its case-insensitive name, parameter count, parameter types, and return type match
  326. exactly. One method may satisfy identical requirements from several interfaces. Incompatible same-name requirements are
  327. rejected because version 1 has no overloading.
  328. Dispatch model
  329. Call site type
  330. Dispatch
  331. Concrete class reference
  332. Static direct call to the known method
  333. Interface reference
  334. Dynamic lookup through the class's table for that interface
  335. Explicit lifetime
  336. - new Class(args) allocates zeroed storage, installs the descriptor, and calls init.
  337. - delete reference calls destroy when present and then releases the full object.
  338. - delete null is a no-op.
  339. - deleting through an interface uses the underlying object and class descriptor.
  340. - reference copies do not maintain an ownership count; use-after-delete remains a program error.
  341. IMPLEMENTATION
  342. BOUNDARY
  343. Layout and interface conformance are verified in the front end. The heap, object descriptors,
  344. construction/deletion routines, field emitter, and concrete-call emitter are implemented and
  345. tested independently. Source-level new/delete and the complete interface-table, conversion,
  346. and dynamic-dispatch path are not implemented.
  347. Repository-based technical documentation
  348. Page 9
  349. NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
  350. Snapshot: 2026-11-20
  351. 6. Statements and expressions
  352. Statement forms
  353. Statement
  354. Shape / rule
  355. Assignment
  356. target = expression
  357. Call
  358. expression.method(arguments)
  359. Conditional
  360. if expression ... [else ...] end if
  361. While loop
  362. while expression ... end while
  363. For loop
  364. for name = start to end [step value] ... end for
  365. Return
  366. return [expression]
  367. Print
  368. print expression
  369. Delete
  370. delete expression
  371. Conditions must have type boolean; numeric values are not truth values. and and or short-circuit from left to right. A for
  372. loop evaluates its end and step expressions once before the first iteration.
  373. Expression precedence, highest to lowest
  374. Level
  375. Operators / forms
  376. Associativity
  377. 1
  378. parentheses, member access, calls, indexing
  379. postfix / grouping
  380. 2
  381. not, unary -
  382. right-nesting
  383. 3
  384. */
  385. left
  386. 4
  387. +-
  388. left
  389. 5
  390. < <= > >=
  391. left
  392. 6
  393. = <>
  394. left
  395. 7
  396. and
  397. left, short-circuit
  398. 8
  399. or
  400. left, short-circuit
  401. Current semantic coverage
  402. The two-pass front end parses every statement form and all precedence levels. It checks assignments, arguments, returns,
  403. conditions, loop expressions, printing, deletion, indexing, access control, member chains, array restrictions, implicit
  404. conversions, and interface conformance. Expression nesting is bounded; exceeding 16 counted levels reports a resource
  405. diagnostic.
  406. Repository-based technical documentation
  407. Page 10
  408. NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
  409. Snapshot: 2026-11-20
  410. 7. Complete language example
  411. This example is valid according to the approved version 1 language. The current front end can analyze it, but the complete
  412. example cannot yet become a runnable PRG because source-level construction, word-valued method bodies and arguments,
  413. concrete-to-interface conversion, dynamic dispatch, and delete-through-interface are unfinished.
  414. interface Printable
  415. method print()
  416. end interface
  417. interface Resettable
  418. method reset()
  419. end interface
  420. class Counter implements Printable, Resettable
  421. private word value
  422. public method init(start as word)
  423. self.value = start
  424. end method
  425. public method increment()
  426. self.value = self.value + 1
  427. end method
  428. public method print()
  429. print self.value
  430. end method
  431. public method reset()
  432. self.value = 0
  433. end method
  434. end class
  435. program Main
  436. var count as Counter
  437. var output as Printable
  438. count = new Counter(10)
  439. count.increment()
  440. output = count
  441. output.print()
  442. delete output
  443. end program
  444. What the compiler must eventually emit
  445. - A Counter descriptor containing its instance size and destructor metadata.
  446. - A Printable method table and a Resettable method table for Counter.
  447. - Heap allocation and descriptor initialization for new Counter(10).
  448. - A direct call for count.increment().
  449. - A concrete-to-interface conversion for output = count.
  450. - An indirect interface call for output.print().
  451. - Destructor lookup and free-list return for delete output.
  452. Repository-based technical documentation
  453. Page 11
  454. NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
  455. Snapshot: 2026-11-20
  456. What is runnable now
  457. The current end-to-end backend compiles counter.n8, a byte-local loop program, into deterministic PRGs with final section
  458. addresses and runs it in x128 with result 15. A separate bounded hello.n8 fixture emits and displays one string literal. These
  459. are real milestones, but they do not yet exercise the complete object/interface example above.
  460. 8. Diagnostics and resource limits
  461. Diagnostic contract
  462. Compile-time diagnostics use stable E-codes, a source name, a line, a column, and a compact message. The screen form is
  463. 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
  464. diagnostic and stops cleanly.
  465. E014 TEST.N8 23 7
  466. BYTE EXPECTED; WORD FOUND
  467. Category
  468. Examples
  469. Lexical
  470. Invalid character, malformed literal, long identifier
  471. Syntax
  472. Expected token, premature line end, missing block terminator
  473. Names
  474. Duplicate declaration, unknown name, table capacity
  475. Types
  476. Mismatch, illegal conversion, invalid index, missing return
  477. Objects
  478. Private access, invalid lifecycle signature, oversize class
  479. Interfaces
  480. Missing/private method, signature mismatch, conflict, wrong kind
  481. I/O
  482. Cannot read source, cannot write ERR, output collision
  483. Resources
  484. Source/line limits, nesting, error limit, bounded tables
  485. Verified limits in this snapshot
  486. Limit
  487. Verified behavior
  488. Source bytes
  489. 18,999 accepted; larger source rejected with position
  490. Logical lines
  491. 599 accepted; line 600 rejected
  492. Line width
  493. 80 accepted; byte 81 rejected
  494. Names
  495. 255 IDs; further names produce bounded errors with guard bytes intact
  496. Expression depth
  497. Bounded at 16 counted levels
  498. Errors
  499. 20 ordinary errors plus one error-limit record
  500. Class size
  501. More than 65,535 bytes rejected as E096
  502. Repository-based technical documentation
  503. Page 12
  504. NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
  505. Snapshot: 2026-11-20
  506. 9. Compiler architecture
  507. Execution boundary
  508. The deliverable compiler is an 8502 program running in C128 native mode. Host tools may assemble and link the compiler,
  509. copy disk files, launch VICE, and compare results. They must not perform Nova128 parsing, type checking, or code
  510. generation in the release workflow.
  511. Three-pass design
  512. Pass
  513. Purpose
  514. Current state
  515. 1 - declarations/layout
  516. Collect types, members, signatures, field offsets, interface slots, and
  517. conformance
  518. Implemented and verified
  519. 2 - semantics/sizing
  520. Resolve bodies and types; size generated routines and data sections
  521. Implemented for the current
  522. bounded emitter; count/emit
  523. mismatch is checked
  524. 3 - emission
  525. Reparse deterministically; emit 8502 code, sections, PRG, and MAP
  526. Working for the current subset;
  527. Counter runs with final addresses
  528. Memory strategy
  529. Region
  530. Compiler use
  531. Bank 0
  532. Resident compiler code, control, parser state, diagnostics, disk/KERNAL wrappers
  533. Bank 1 $2000-$6AFF
  534. Whole-source cache; read once and replayed for each pass
  535. Bank 1 $6B00-$BFFF
  536. 21,760-byte window for names, types, members, parameters, and work tables
  537. COMMON $1300-$18FF
  538. MMU transitions and state required while either bank is selected
  539. Private logical zero page
  540. $02-$FF via relocated page pointer P0
  541. Software stack
  542. $B800-$BFFF for substantial compiler stacks
  543. Banking and KERNAL discipline
  544. Only the MMU module changes memory mappings. KERNAL calls run through wrappers that install a compatible mapping,
  545. perform the operation, capture status, and restore the exact compiler state. Compiler states mask IRQs and guard the NMI
  546. vector so RESTORE is ignored during critical compilation states.
  547. Repository-based technical documentation
  548. Page 13
  549. NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
  550. Snapshot: 2026-11-20
  551. 10. Implementation status
  552. STATUS MODEL
  553. Verified means the repository has implementation and passing current evidence. In progress
  554. means code exists but acceptance is incomplete. Planned means specified in the backlog
  555. without a completed implementation claim.
  556. Area
  557. State
  558. Evidence / boundary
  559. C128 platform probes
  560. VERIFIED
  561. Native PRG, MMU/common RAM, KERNAL wrapper, display/clock, and compiler memory
  562. map
  563. Source reader
  564. VERIFIED
  565. Whole-file bank-1 cache, exact rewind, source/line limits, missing final CR
  566. Lexer
  567. VERIFIED
  568. PETSCII normalization, tokens, literals, comments, operators, exact positions
  569. Name interning
  570. VERIFIED
  571. Case folding, first spelling, collisions, 255-name bounded table
  572. Diagnostics
  573. VERIFIED
  574. 73 catalog entries, 40-column form, ERR writer, 20-error limit
  575. Declarations/scopes
  576. VERIFIED
  577. Types, members, parameters, locals, ordering, duplicate checks, access
  578. Statements/expressions
  579. VERIFIED
  580. All version 1 forms, precedence, recovery, nesting bound
  581. Type checking
  582. VERIFIED
  583. Conversions, calls, returns, operators, arrays, constant folding
  584. Class layout
  585. VERIFIED
  586. Descriptor prefix, field offsets, size calculation, overflow diagnostic
  587. Interface conformance
  588. VERIFIED
  589. Stable slots, exact signatures, conflicts, access, wrong-kind errors
  590. Disposable D81 builder
  591. VERIFIED
  592. Copies the Vim image and injects artifacts without changing the original
  593. PRG/MAP container
  594. VERIFIED
  595. Load header, BASIC 7 stub, ordered sections, MAP, collision refusal, failure cleanup
  596. Frames and scalar codegen
  597. VERIFIED
  598. Software frames, arithmetic helpers, bounded emitter, golden 231-byte stream
  599. Control flow and sizing
  600. VERIFIED
  601. Short/long branches, calls/returns, count mode, final addresses, deterministic PRGs
  602. Source-driven emission
  603. IN PROGRESS
  604. Counter runs; current path remains byte-centered with restricted calls, for loops, frames,
  605. and 255-byte routines
  606. Print and runtime faults
  607. VERIFIED
  608. All scalar printers plus R001-R005; hello.n8 bounded proof runs
  609. Heap and object runtime
  610. VERIFIED
  611. Free list, descriptors, new/delete routines, fields, and concrete-call primitives tested
  612. Fixed arrays/bounds
  613. PLANNED
  614. Front-end rules exist; generated indexing and runtime bounds faults are E05-S05
  615. Production compiler driver
  616. PLANNED
  617. No final N128C.PRG command loop that compiles arbitrary supported programs
  618. Interface dispatch runtime
  619. PLANNED
  620. No indirect-call trampoline or emitted implementation tables yet
  621. Integrated workflow/release
  622. PLANNED
  623. Launchers, end-to-end walkthrough, regression hardening, and release media remain
  624. Repository-based technical documentation
  625. Page 14
  626. NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
  627. Snapshot: 2026-11-20
  628. 11. Current verification evidence
  629. The table summarizes the latest completed claim evidence recorded in the repository through November 10, 2026, audited
  630. against the November 20 working tree. The current audit also rebuilt the Counter fixture and observed it reach the mailbox
  631. before the shared test helper timed out while asking x128 to exit; that cleanup defect is reported as harness work rather than
  632. treated as a language failure.
  633. Suite
  634. Result
  635. Source reader
  636. PASS - 8 checks, including 18,999 bytes, 599 lines, 80-byte line, missing source, and exact rewind
  637. Lexer
  638. PASS - 10 fixtures, 6,733-byte dump, exact golden-token match
  639. Names
  640. PASS - 2,217-byte dump matches host model; 255-name capacity; guards intact
  641. Parser/semantic
  642. PASS - 42 fixtures; accepted/rejected forms, exact diagnostics, layouts, interface slots, and one-error unresolved
  643. reference
  644. Diagnostics
  645. PASS - 73-entry catalog in sync; screen and ERR files match
  646. PRG/MAP writer
  647. PASS - 133-byte fixture PRG, exact MAP, executable startup, collision preservation, and abort/order cleanup
  648. Frames/scalar/control
  649. PASS - recursion, overflow guard, 231-byte scalar golden, short/long branches, nested control and calls
  650. Print/faults/Hello
  651. PASS - all scalar forms, R001-R005, mapping preservation, 118-byte HELLO.PRG displays text
  652. Source-compiled Counter
  653. PASS in completed claim - 175 code bytes, zero sizing mismatches, byte-identical PRGs, result 15
  654. Heap/classes/objects
  655. PASS - allocation/coalescing/exhaustion, descriptor/MAP records, init/destroy/delete, independent fields
  656. Current audit caveat
  657. A November 20 spot-check of verify-counter-test.ps1 built the current sources and reached the test mailbox, then
  658. failed in cleanup with x128 did not exit. The helper waits ten seconds after sending the remote-monitor quit command.
  659. The repository's completed claim evidence remains the latest full Counter acceptance run; E08-S01 should make emulator
  660. startup, shutdown, timeout, and artifact recovery robust enough that a cleanup failure cannot obscure a completed test.
  661. DO NOT
  662. OVERSTATE
  663. Counter proves native code generation for a bounded procedural subset. It does not prove
  664. arbitrary version 1 programs, source-level object lifetime, arrays, interface conversions or calls,
  665. general method arguments/results, or a production N128C.PRG user workflow.
  666. Repository-based technical documentation
  667. Page 15
  668. NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
  669. Snapshot: 2026-11-20
  670. Planning progress by epic
  671. Epic
  672. Done
  673. Active
  674. Remaining
  675. E00 - specification
  676. 3
  677. 0
  678. 0
  679. E01 - C128 foundation
  680. 5
  681. 0
  682. 0
  683. E02 - source/lexer/names/diagnostics
  684. 4
  685. 0
  686. 0
  687. E03 - parser and semantic model
  688. 6
  689. 0
  690. 0
  691. E04 - procedural code generation
  692. 7
  693. 0
  694. 0
  695. E05 - classes and heap
  696. 4
  697. 0
  698. 1
  699. E06 - interfaces and dispatch
  700. 0
  701. 0
  702. 6
  703. E07 - Vim/disk workflow
  704. 1
  705. 0
  706. 3
  707. E08 - hardening/release
  708. 0
  709. 0
  710. 6
  711. Total
  712. 30
  713. 0
  714. 16
  715. Repository-based technical documentation
  716. Page 16
  717. NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
  718. Snapshot: 2026-11-20
  719. 12. What needs to be worked on
  720. Priority 1 - close the source-to-code gaps left by E04
  721. - Replace the fixture-owned startup/frame setup with a production generated-program startup that initializes mapping,
  722. frames, runtime pointers, and clean termination.
  723. - Generate one- and two-byte expressions, assignments, parameters, call arguments, method results, and frame
  724. prologues/epilogues from source, not only from isolated emitters.
  725. - Lift or deliberately specify the 255-byte per-routine buffer, 64-label/128-fixup bounds, and one-byte entry-offset limits.
  726. - Generalize for loops beyond constant byte end and step 1, and make print support every specified scalar through the
  727. integrated path.
  728. - Integrate source-level new/delete with the proven heap and object runtime, including R005 on allocation failure.
  729. Priority 2 - finish arrays and bounds behavior
  730. E05-S05 is the only remaining class/heap story. It must emit local and field array addressing, handle one- and two-byte
  731. element sizes, prove constant and computed indexes, and route invalid runtime indexes through R002. The release/debug
  732. bounds-check policy also needs to be stated consistently; the front end currently checks constant indexes but no general
  733. array code is emitted.
  734. Priority 3 - implement interface polymorphism
  735. Story
  736. Required result
  737. E06-S01
  738. Freeze the four-byte interface ABI, storage rules, return convention, and clobber contract
  739. E06-S02
  740. Build a guarded indirect-call trampoline and prove nested/recursive returns
  741. E06-S03
  742. Emit per-class interface method tables and deterministic MAP records
  743. E06-S04
  744. Generate concrete-to-interface conversions for locals, fields, parameters, and returns
  745. E06-S05
  746. Generate interface slot calls with correct self, arguments, and results
  747. E06-S06
  748. Delete through interfaces; handle null and promised debug failure paths
  749. Priority 4 - produce the real compiler application
  750. - Assemble a production N128C.PRG command loop that accepts a source base name and orchestrates source, diagnostics,
  751. sizing, emission, PRG, ERR, and MAP output.
  752. - Freeze the generated-program memory map: code/data limits, heap base/size, software stack, runtime workspace, zero
  753. page, and interrupt policy.
  754. - Budget every compiler table inside the 21,760-byte bank-1 window and turn every overflow into a stable diagnostic.
  755. - Resolve the 23 currently Proposed decisions (D119-D141), especially user-visible semantics, MAP formats, and ABI choices,
  756. before release freeze.
  757. Repository-based technical documentation
  758. Page 17
  759. NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
  760. Snapshot: 2026-11-20
  761. 13. Integration, hardening, and release work
  762. Editor and compiler workflow
  763. The version 1 workflow deliberately keeps the C64 Vim clone separate from the C128 compiler. The remaining work is to
  764. provide safe sequential launchers, prove a source round-trip created entirely in Vim, and document the full
  765. edit/check/compile/run cycle. The same writable D81 must never be attached to x64sc and x128 at the same time.
  766. Story
  767. Outcome
  768. E07-S02
  769. Sequential x64sc editor and x128 compiler launchers that wait for disk flush
  770. E07-S03
  771. Vim-created PETSCII source round-trips byte-for-byte and tokenizes on the C128
  772. E07-S04
  773. User walkthrough for editing, compiling, diagnostics, collisions, and running an interface sample
  774. Regression and release
  775. - Automated x128 regression harness with fresh images, time limits, artifact extraction, precise failure reporting, and reliable
  776. emulator shutdown even after a test reaches its mailbox.
  777. - Golden byte/disassembly coverage for scalar code, branches, frames, objects, lifetime, conversion, and dispatch.
  778. - Capacity and error-path stress for every table, stack, heap, disk failure, and diagnostic limit.
  779. - Conformance suite mapping every normative language section to executable evidence or explicit review.
  780. - Reproducible compiler PRG, development D81, checksums, user guide, developer guide, and release notes.
  781. - Physical C128 smoke testing when hardware is available; emulator/hardware differences become tracked work.
  782. Recommended milestone sequence
  783. Integrated scalar/call/startup path
  784. -> arrays and bounds
  785. -> interface ABI / trampoline
  786. -> interface tables / conversion / calls / lifetime
  787. -> production N128C.PRG and editor workflow
  788. -> regression, conformance, release
  789. Repository-based technical documentation
  790. Page 18
  791. NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
  792. Snapshot: 2026-11-20
  793. 14. Open decisions and risks
  794. Topic
  795. Current position
  796. Why it matters
  797. Generated-program
  798. memory map
  799. Container, provisional frame stack, and fixture heap
  800. exist; production placement is still open
  801. Blocks a general compiler/runtime image and reliable
  802. capacity claims
  803. Compiler table capacities
  804. 21,760-byte bank-1 table window is frozen; final
  805. per-table capacities remain to be budgeted
  806. Every table must fail cleanly instead of corrupting memory
  807. Proposed decisions
  808. D119-D141 remain proposed even where behavior
  809. and formats are implemented
  810. Visible semantics, ABI, MAP, and capacity choices should be
  811. explicitly accepted before release freeze
  812. Backend limits
  813. 255 code bytes, 64 labels, 128 fixups, byte-centered
  814. source path, restricted calls and loops
  815. A completed story can still reject ordinary version 1
  816. programs with E227
  817. Interrupt behavior
  818. Compiler runs non-default mappings with IRQs
  819. masked; NMI is guarded
  820. Generated programs need their own final interrupt/runtime
  821. policy
  822. Alias lifetime
  823. No ownership counts or full lifetime proof
  824. Use-after-delete is a program error; debug detection is
  825. necessarily partial
  826. Hardware validation
  827. VICE x128 is mandatory; physical hardware is P2
  828. Timing or device differences may appear late
  829. Harness cleanup
  830. Current spot-check reached the mailbox but x128
  831. did not exit within the helper's ten-second wait
  832. E08-S01 must separate program results from emulator
  833. lifecycle failures
  834. Scope guardrails
  835. The safest path is to finish version 1's existing dependency chain before adding new syntax or runtime features. Changes to
  836. syntax, type rules, object layout, interface ABI, file formats, memory ownership, or supported targets require a recorded
  837. decision. The current design intentionally trades breadth for a compiler that can fit, diagnose, and run predictably on real
  838. C128 hardware.
  839. Repository-based technical documentation
  840. Page 19
  841. NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
  842. Snapshot: 2026-11-20
  843. Section 15 - Current practical workflow
  844. Front-end edit/check demonstration
  845. The repository includes a write-and-check demonstration. It copies the Vim work disk, uses x64sc to create a Nova128 file
  846. with the C64-mode Vim clone, then closes x64sc and uses x128 to run the Nova128 front-end checker. Valid input reports no
  847. errors; invalid input produces stable E-codes and a NAME.ERR file.
  848. cd newLang
  849. pwsh -File scripts/demo-write-check.ps1
  850. Current end-to-end code-generation demonstration
  851. The Counter verifier builds the on-machine compile fixture, compiles counter.n8 twice, checks byte-identical PRGs and the
  852. final MAP, then runs the generated program. Its completed claim records result 15 and zero size mismatches.
  853. cd newLang
  854. pwsh -File scripts/verify-counter-test.ps1
  855. What does not work yet
  856. There is not yet a production N128C.PRG that accepts an arbitrary source name and emits native code for the whole version
  857. 1 language. The existing compile drivers are fixtures. The complete class/interface example remains blocked on integrated
  858. construction, general arguments and word values, arrays, interface tables/conversion/dispatch, and deletion through an
  859. interface. Safe editor/compiler launchers and the user walkthrough are also not finished.
  860. Safe disk rule
  861. NEVER MODIFY
  862. THE TEMPLATE
  863. The original vim/work.d81 and reference disk images are inputs. Build and test scripts must
  864. create writable copies under newLang/build. x64sc and x128 must not share the same writable
  865. image concurrently.
  866. Repository-based technical documentation
  867. Page 20
  868. NOVA128 LANGUAGE AND IMPLEMENTATION STATUS
  869. Snapshot: 2026-11-20
  870. Appendix A - Source documents reviewed
  871. Repository source
  872. Used for
  873. newLang/README.md
  874. Product boundary and intended editor/compiler workflow
  875. newLang/docs/decisions.md
  876. Accepted, proposed, deferred, and open decisions
  877. newLang/docs/language-spec.md
  878. Normative version 1 syntax and semantics
  879. newLang/docs/architecture.md
  880. Compiler passes, memory strategy, ABI, and runtime plan
  881. newLang/docs/memory-map.md
  882. Frozen compiler memory placement and evidence
  883. newLang/docs/diagnostics.md
  884. Generated stable diagnostic catalog
  885. newLang/planning/epics-and-stories.md
  886. Full 46-story backlog and dependencies
  887. newLang/planning/claims/*.md
  888. 30 completed claims, acceptance evidence, implementation limits, and remaining risks
  889. newLang/src/compiler/*.s
  890. Reader, lexer, names, parser, types, semantics, codegen, flow, sizing, members, diagnostics,
  891. disk I/O, and output
  892. newLang/tests and newLang/scripts
  893. Fixtures, golden expectations, build scripts, and x128 verifiers
  894. Snapshot caveat
  895. This document describes the working tree observed on November 20, 2026. It distinguishes completed claim evidence from
  896. the narrower product behavior currently demonstrated by source-driven fixtures. Future commits may change
  897. implementation status, test counts, diagnostics, ABI decisions, or the roadmap. Normative language behavior remains the
  898. repository's specification and decisions files.
  899. BOTTOM LINE
  900. Nova128 has crossed the first native-code milestone: a real source program compiles and runs.
  901. The next decisive work is to turn the bounded fixture path into the general version 1 compiler,
  902. integrate the proven object runtime, then deliver the required interface ABI and dynamic
  903. dispatch before workflow and release hardening.
  904. Repository-based technical documentation
  905. Page 21

Powered by TurnKey Linux.