|
- from reportlab.lib import colors
- from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_RIGHT
- from reportlab.lib.pagesizes import letter
- from reportlab.lib.styles import ParagraphStyle, getSampleStyleSheet
- from reportlab.lib.units import inch
- from reportlab.pdfbase.ttfonts import TTFont
- from reportlab.pdfbase import pdfmetrics
- from reportlab.platypus import (
- BaseDocTemplate,
- PageTemplate,
- Frame,
- Paragraph,
- Spacer,
- PageBreak,
- KeepTogether,
- Table,
- TableStyle,
- Preformatted,
- HRFlowable,
- NextPageTemplate,
- )
- from reportlab.platypus.tableofcontents import TableOfContents
- from reportlab.pdfgen import canvas
- from reportlab.lib.colors import HexColor
- from pathlib import Path
- from xml.sax.saxutils import escape
- import re
-
-
- ROOT = Path(r"C:\Development\Commodore\C64-dev")
- OUT = ROOT / "output" / "pdf" / "Nova128-Language-Reference-and-Status.pdf"
-
- NAVY = HexColor("#14243A")
- NAVY_2 = HexColor("#203853")
- TEAL = HexColor("#148B8B")
- TEAL_LIGHT = HexColor("#E7F5F3")
- ORANGE = HexColor("#E2783E")
- ORANGE_LIGHT = HexColor("#FFF0E7")
- INK = HexColor("#24303D")
- MUTED = HexColor("#647383")
- LINE = HexColor("#D8E0E8")
- PALE = HexColor("#F4F7FA")
- GREEN = HexColor("#247A52")
- GREEN_LIGHT = HexColor("#E7F4ED")
- RED = HexColor("#A53F3F")
- RED_LIGHT = HexColor("#FBEAEA")
- WHITE = colors.white
-
-
- def register_fonts():
- candidates = {
- "NovaSans": Path(r"C:\Windows\Fonts\segoeui.ttf"),
- "NovaSans-Bold": Path(r"C:\Windows\Fonts\segoeuib.ttf"),
- "NovaMono": Path(r"C:\Windows\Fonts\consola.ttf"),
- "NovaMono-Bold": Path(r"C:\Windows\Fonts\consolab.ttf"),
- }
- for name, path in candidates.items():
- if path.exists():
- pdfmetrics.registerFont(TTFont(name, str(path)))
- return (
- "NovaSans" if "NovaSans" in pdfmetrics.getRegisteredFontNames() else "Helvetica",
- "NovaSans-Bold" if "NovaSans-Bold" in pdfmetrics.getRegisteredFontNames() else "Helvetica-Bold",
- "NovaMono" if "NovaMono" in pdfmetrics.getRegisteredFontNames() else "Courier",
- "NovaMono-Bold" if "NovaMono-Bold" in pdfmetrics.getRegisteredFontNames() else "Courier-Bold",
- )
-
-
- SANS, SANS_BOLD, MONO, MONO_BOLD = register_fonts()
-
-
- class NovaDocTemplate(BaseDocTemplate):
- def __init__(self, filename, **kwargs):
- super().__init__(filename, **kwargs)
-
- def afterFlowable(self, flowable):
- if isinstance(flowable, Paragraph):
- style_name = flowable.style.name
- if style_name in ("H1", "H2"):
- level = 0 if style_name == "H1" else 1
- text = flowable.getPlainText()
- key = "heading-" + re.sub(r"[^a-z0-9]+", "-", text.lower()).strip("-")
- self.canv.bookmarkPage(key)
- self.canv.addOutlineEntry(text, key, level=level, closed=False)
- self.notify("TOCEntry", (level, text, self.page, key))
-
-
- def make_styles():
- ss = getSampleStyleSheet()
- return {
- "Title": ParagraphStyle(
- "Title",
- parent=ss["Title"],
- fontName=SANS_BOLD,
- fontSize=30,
- leading=34,
- textColor=WHITE,
- alignment=TA_LEFT,
- spaceAfter=12,
- ),
- "Subtitle": ParagraphStyle(
- "Subtitle",
- parent=ss["Normal"],
- fontName=SANS,
- fontSize=14,
- leading=20,
- textColor=HexColor("#CFE5E7"),
- ),
- "H1": ParagraphStyle(
- "H1",
- parent=ss["Heading1"],
- fontName=SANS_BOLD,
- fontSize=21,
- leading=25,
- textColor=NAVY,
- spaceBefore=4,
- spaceAfter=12,
- keepWithNext=True,
- ),
- "H2": ParagraphStyle(
- "H2",
- parent=ss["Heading2"],
- fontName=SANS_BOLD,
- fontSize=14,
- leading=18,
- textColor=TEAL,
- spaceBefore=12,
- spaceAfter=7,
- keepWithNext=True,
- ),
- "H3": ParagraphStyle(
- "H3",
- parent=ss["Heading3"],
- fontName=SANS_BOLD,
- fontSize=10.5,
- leading=14,
- textColor=NAVY_2,
- spaceBefore=8,
- spaceAfter=4,
- keepWithNext=True,
- ),
- "Body": ParagraphStyle(
- "Body",
- parent=ss["BodyText"],
- fontName=SANS,
- fontSize=9.2,
- leading=13.2,
- textColor=INK,
- spaceAfter=6,
- ),
- "Small": ParagraphStyle(
- "Small",
- parent=ss["BodyText"],
- fontName=SANS,
- fontSize=7.8,
- leading=10.5,
- textColor=MUTED,
- spaceAfter=4,
- ),
- "Bullet": ParagraphStyle(
- "Bullet",
- parent=ss["BodyText"],
- fontName=SANS,
- fontSize=9,
- leading=12.7,
- textColor=INK,
- leftIndent=13,
- firstLineIndent=-8,
- bulletIndent=3,
- spaceAfter=3.5,
- ),
- "Code": ParagraphStyle(
- "Code",
- parent=ss["Code"],
- fontName=MONO,
- fontSize=7.6,
- leading=10,
- textColor=colors.black,
- leftIndent=0,
- rightIndent=0,
- spaceBefore=0,
- spaceAfter=0,
- ),
- "TableHead": ParagraphStyle(
- "TableHead",
- parent=ss["BodyText"],
- fontName=SANS_BOLD,
- fontSize=7.7,
- leading=9.5,
- textColor=WHITE,
- alignment=TA_LEFT,
- ),
- "TableCell": ParagraphStyle(
- "TableCell",
- parent=ss["BodyText"],
- fontName=SANS,
- fontSize=7.5,
- leading=9.8,
- textColor=INK,
- ),
- "TableCellBold": ParagraphStyle(
- "TableCellBold",
- parent=ss["BodyText"],
- fontName=SANS_BOLD,
- fontSize=7.5,
- leading=9.8,
- textColor=INK,
- ),
- "CalloutTitle": ParagraphStyle(
- "CalloutTitle",
- parent=ss["BodyText"],
- fontName=SANS_BOLD,
- fontSize=10,
- leading=13,
- textColor=NAVY,
- spaceAfter=3,
- ),
- "CalloutBody": ParagraphStyle(
- "CalloutBody",
- parent=ss["BodyText"],
- fontName=SANS,
- fontSize=8.8,
- leading=12.2,
- textColor=INK,
- ),
- "TOC0": ParagraphStyle(
- "TOC0",
- fontName=SANS_BOLD,
- fontSize=10,
- leading=15,
- leftIndent=0,
- firstLineIndent=0,
- textColor=NAVY,
- ),
- "TOC1": ParagraphStyle(
- "TOC1",
- fontName=SANS,
- fontSize=8.5,
- leading=12,
- leftIndent=14,
- firstLineIndent=0,
- textColor=MUTED,
- ),
- }
-
-
- ST = make_styles()
-
-
- def p(text, style="Body"):
- return Paragraph(text, ST[style])
-
-
- def bullet(text):
- return Paragraph("- " + text, ST["Bullet"])
-
-
- def code(text):
- block = Preformatted(text.strip("\n"), ST["Code"])
- table = Table([[block]], colWidths=[6.9 * inch], hAlign="LEFT")
- table.setStyle(TableStyle([
- ("BACKGROUND", (0, 0), (-1, -1), PALE),
- ("BOX", (0, 0), (-1, -1), 0.7, LINE),
- ("LEFTPADDING", (0, 0), (-1, -1), 9),
- ("RIGHTPADDING", (0, 0), (-1, -1), 9),
- ("TOPPADDING", (0, 0), (-1, -1), 7),
- ("BOTTOMPADDING", (0, 0), (-1, -1), 7),
- ]))
- return table
-
-
- def callout(title, body, kind="info"):
- palette = {
- "info": (TEAL_LIGHT, TEAL),
- "warn": (ORANGE_LIGHT, ORANGE),
- "good": (GREEN_LIGHT, GREEN),
- "risk": (RED_LIGHT, RED),
- }
- bg, edge = palette[kind]
- t = Table([[p(title, "CalloutTitle"), p(body, "CalloutBody")]], colWidths=[1.55 * inch, 5.35 * inch])
- t.setStyle(TableStyle([
- ("BACKGROUND", (0, 0), (-1, -1), bg),
- ("BOX", (0, 0), (-1, -1), 0.8, edge),
- ("LINEBEFORE", (0, 0), (0, -1), 5, edge),
- ("VALIGN", (0, 0), (-1, -1), "TOP"),
- ("LEFTPADDING", (0, 0), (-1, -1), 9),
- ("RIGHTPADDING", (0, 0), (-1, -1), 9),
- ("TOPPADDING", (0, 0), (-1, -1), 8),
- ("BOTTOMPADDING", (0, 0), (-1, -1), 8),
- ]))
- return t
-
-
- def data_table(headers, rows, widths, compact=False):
- head = [p(escape(str(x)), "TableHead") for x in headers]
- body = []
- for row in rows:
- cells = []
- for i, value in enumerate(row):
- if isinstance(value, Paragraph):
- cells.append(value)
- else:
- style = "TableCellBold" if i == 0 else "TableCell"
- cells.append(p(escape(str(value)), style))
- body.append(cells)
- t = Table([head] + body, colWidths=widths, repeatRows=1, hAlign="LEFT", splitByRow=1)
- pad = 4 if compact else 5
- commands = [
- ("BACKGROUND", (0, 0), (-1, 0), NAVY_2),
- ("TEXTCOLOR", (0, 0), (-1, 0), WHITE),
- ("GRID", (0, 0), (-1, -1), 0.35, LINE),
- ("VALIGN", (0, 0), (-1, -1), "TOP"),
- ("LEFTPADDING", (0, 0), (-1, -1), pad),
- ("RIGHTPADDING", (0, 0), (-1, -1), pad),
- ("TOPPADDING", (0, 0), (-1, -1), pad),
- ("BOTTOMPADDING", (0, 0), (-1, -1), pad),
- ]
- for idx in range(1, len(body) + 1):
- if idx % 2 == 0:
- commands.append(("BACKGROUND", (0, idx), (-1, idx), PALE))
- t.setStyle(TableStyle(commands))
- return t
-
-
- def status_table(rows):
- data = [[p("Area", "TableHead"), p("State", "TableHead"), p("Evidence / boundary", "TableHead")]]
- color_map = {"VERIFIED": GREEN, "IN PROGRESS": ORANGE, "PLANNED": MUTED, "DEFERRED": RED}
- for area, state, detail in rows:
- state_cell = Paragraph(f"<b><font color='{color_map[state].hexval()}'>{state}</font></b>", ST["TableCell"])
- data.append([p(escape(area), "TableCellBold"), state_cell, p(escape(detail), "TableCell")])
- t = Table(data, colWidths=[1.6 * inch, 1.0 * inch, 4.3 * inch], repeatRows=1, hAlign="LEFT")
- cmds = [
- ("BACKGROUND", (0, 0), (-1, 0), NAVY_2),
- ("GRID", (0, 0), (-1, -1), 0.35, LINE),
- ("VALIGN", (0, 0), (-1, -1), "TOP"),
- ("LEFTPADDING", (0, 0), (-1, -1), 5),
- ("RIGHTPADDING", (0, 0), (-1, -1), 5),
- ("TOPPADDING", (0, 0), (-1, -1), 5),
- ("BOTTOMPADDING", (0, 0), (-1, -1), 5),
- ]
- for i in range(1, len(data)):
- if i % 2 == 0:
- cmds.append(("BACKGROUND", (0, i), (-1, i), PALE))
- t.setStyle(TableStyle(cmds))
- return t
-
-
- def draw_title_page(c, doc):
- w, h = letter
- c.saveState()
- c.setFillColor(NAVY)
- c.rect(0, 0, w, h, fill=1, stroke=0)
- c.setFillColor(TEAL)
- c.rect(0, h - 22, w, 22, fill=1, stroke=0)
- c.setFillColor(ORANGE)
- c.rect(0, 0, 15, h, fill=1, stroke=0)
-
- # A restrained 8-bit motif.
- c.setFillColor(HexColor("#1D3D57"))
- for row in range(7):
- for col in range(13):
- if (row * 3 + col * 5) % 7 in (0, 1):
- c.rect(390 + col * 14, 78 + row * 14, 9, 9, fill=1, stroke=0)
-
- c.setFillColor(TEAL_LIGHT)
- c.setFont(SANS_BOLD, 10)
- c.drawString(52, h - 82, "COMMODORE 128 - LANGUAGE AND COMPILER PROJECT")
-
- c.setFillColor(WHITE)
- c.setFont(SANS_BOLD, 31)
- c.drawString(52, h - 145, "Nova128")
- c.setFont(SANS_BOLD, 22)
- c.drawString(52, h - 179, "Language Reference")
- c.drawString(52, h - 208, "and Implementation Status")
-
- c.setFillColor(HexColor("#CFE5E7"))
- c.setFont(SANS, 12)
- c.drawString(52, h - 246, "What the language is today, what is proven, and what remains")
-
- c.setStrokeColor(TEAL)
- c.setLineWidth(2)
- c.line(52, h - 280, 300, h - 280)
-
- c.setFillColor(WHITE)
- c.setFont(SANS_BOLD, 12)
- c.drawString(52, 150, "Repository snapshot")
- c.setFont(SANS, 11)
- c.setFillColor(HexColor("#CFE5E7"))
- c.drawString(52, 131, "November 20, 2026")
- c.drawString(52, 111, "Target: Commodore 128 native 8502 mode")
- c.drawString(52, 91, "Compiler: on-machine ca65 assembly implementation")
- c.restoreState()
-
-
- def draw_content_page(c, doc):
- w, h = letter
- c.saveState()
- c.setStrokeColor(LINE)
- c.setLineWidth(0.5)
- c.line(48, h - 42, w - 48, h - 42)
- c.setFont(SANS_BOLD, 7.5)
- c.setFillColor(NAVY_2)
- c.drawString(48, h - 31, "NOVA128 LANGUAGE AND IMPLEMENTATION STATUS")
- c.setFont(SANS, 7.5)
- c.setFillColor(MUTED)
- c.drawRightString(w - 48, h - 31, "Snapshot: 2026-11-20")
- c.line(48, 39, w - 48, 39)
- c.setFont(SANS, 7.2)
- c.drawString(48, 26, "Repository-based technical documentation")
- c.drawRightString(w - 48, 26, f"Page {doc.page}")
- c.restoreState()
-
-
- def h1(title):
- return [Paragraph(escape(title), ST["H1"]), HRFlowable(width="100%", thickness=1.2, color=TEAL, spaceAfter=9)]
-
-
- def h2(title):
- return Paragraph(escape(title), ST["H2"])
-
-
- def build_story():
- story = []
-
- # Title page is drawn entirely by the page callback.
- story += [Spacer(1, 9.1 * inch), NextPageTemplate("content"), PageBreak()]
-
- story += h1("Contents")
- toc = TableOfContents()
- toc.levelStyles = [ST["TOC0"], ST["TOC1"]]
- toc.dotsMinLevel = 0
- story += [toc, PageBreak()]
-
- story += h1("Executive summary")
- story.append(callout(
- "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.",
- "warn",
- ))
- story.append(Spacer(1, 10))
- story.append(p(
- "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.",
- ))
- story.append(p(
- "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.",
- ))
- story.append(Spacer(1, 4))
- story.append(data_table(
- ["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"],
- ],
- [1.75 * inch, 5.15 * inch],
- ))
- story.append(h2("What this document means by implemented"))
- story.append(p(
- "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.",
- ))
- story.append(PageBreak())
-
- story += h1("1. Language profile")
- story.append(callout(
- "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.",
- "info",
- ))
- story.append(h2("Version 1 at a glance"))
- for item in [
- "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.",
- ]:
- story.append(bullet(item))
-
- story.append(h2("Deliberately excluded from version 1"))
- story.append(p(
- "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.",
- ))
-
- story.append(h2("Source and file conventions"))
- story.append(data_table(
- ["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"],
- ],
- [1.65 * inch, 5.25 * inch],
- ))
- story.append(PageBreak())
-
- story += h1("2. Lexical syntax")
- story.append(h2("Tokens and literals"))
- story.append(data_table(
- ["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", r'\" \\ \n \r', "Both newline escapes currently map to PETSCII $0D"],
- ["Character escapes", r"\' \\ \n \r", "Exactly one resulting byte"],
- ],
- [1.25 * inch, 1.8 * inch, 3.85 * inch],
- ))
- story.append(h2("Operators and punctuation"))
- story.append(p(
- "Reserved punctuation is <font name='NovaMono'>( ) [ ] , . : = + - * / < > <> <= >=</font>. Boolean operators are the words <font name='NovaMono'>and</font>, <font name='NovaMono'>or</font>, and <font name='NovaMono'>not</font>; symbolic aliases such as <font name='NovaMono'>&&</font> and <font name='NovaMono'>||</font> are not part of the language.",
- ))
- story.append(h2("Line discipline"))
- story.append(p(
- "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.",
- ))
- story.append(callout(
- "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.",
- "good",
- ))
- story.append(PageBreak())
-
- story += h1("3. Types, values, and conversions")
- story.append(h2("Primitive representation"))
- story.append(data_table(
- ["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"],
- ],
- [1.25 * inch, 1.0 * inch, 4.65 * inch],
- ))
- story.append(h2("Reference representation"))
- story.append(data_table(
- ["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"],
- ],
- [1.55 * inch, 1.15 * inch, 4.2 * inch],
- ))
- story.append(h2("Implicit conversion rules"))
- for item in [
- "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.",
- ]:
- story.append(bullet(item))
- story.append(h2("Numeric operations"))
- story.append(p(
- "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.",
- ))
- story.append(h2("Fixed-size arrays"))
- story.append(p(
- "Arrays use <font name='NovaMono'>type[length]</font>, 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.",
- ))
- story.append(PageBreak())
-
- story += h1("4. Program structure and declarations")
- story.append(p(
- "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.",
- ))
- story.append(code(r"""
- 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 = [ access ], type, name, EOL
- variable-decl = "var", name, "as", type, EOL
- access = "public" | "private"
- """))
- story.append(h2("Declaration rules"))
- for item in [
- "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.",
- ]:
- story.append(bullet(item))
- story.append(h2("Constructor and destructor shapes"))
- story.append(p(
- "The optional constructor is named <font name='NovaMono'>init</font>. A class may declare at most one. It takes ordinary parameters but returns no value. The optional destructor is named <font name='NovaMono'>destroy</font>; it takes no explicit parameters and returns no value.",
- ))
- story.append(PageBreak())
-
- story += h1("5. Classes, interfaces, and lifetime")
- story.append(h2("Object behavior"))
- story.append(p(
- "Every instance method has an implicit <font name='NovaMono'>self</font> 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; <font name='NovaMono'>self.field</font> explicitly selects the field.",
- ))
- story.append(h2("Object layout contract"))
- story.append(code(r"""
- +0 class descriptor pointer (2 bytes)
- +2 first field, in declaration order
- ... remaining fields, with no hidden alignment padding
- """))
- story.append(p(
- "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.",
- ))
- story.append(h2("Interface declaration and conformance"))
- story.append(p(
- "Interfaces contain method signatures only. A class names one or more contracts with <font name='NovaMono'>implements</font>. 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.",
- ))
- story.append(h2("Dispatch model"))
- story.append(data_table(
- ["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"],
- ],
- [2.0 * inch, 4.9 * inch],
- ))
- story.append(h2("Explicit lifetime"))
- for item in [
- "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.",
- ]:
- story.append(bullet(item))
- story.append(callout(
- "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.",
- "warn",
- ))
- story.append(PageBreak())
-
- story += h1("6. Statements and expressions")
- story.append(h2("Statement forms"))
- story.append(data_table(
- ["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"],
- ],
- [1.4 * inch, 5.5 * inch],
- ))
- story.append(p(
- "Conditions must have type boolean; numeric values are not truth values. <font name='NovaMono'>and</font> and <font name='NovaMono'>or</font> short-circuit from left to right. A for loop evaluates its end and step expressions once before the first iteration.",
- ))
- story.append(h2("Expression precedence, highest to lowest"))
- story.append(data_table(
- ["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"],
- ],
- [0.7 * inch, 3.65 * inch, 2.55 * inch],
- ))
- story.append(h2("Current semantic coverage"))
- story.append(p(
- "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.",
- ))
- story.append(PageBreak())
-
- story += h1("7. Complete language example")
- story.append(p(
- "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.",
- ))
- story.append(code(r"""
- 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
- """))
- story.append(h2("What the compiler must eventually emit"))
- for item in [
- "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.",
- ]:
- story.append(bullet(item))
- story.append(h2("What is runnable now"))
- story.append(p(
- "The current end-to-end backend compiles <font name='NovaMono'>counter.n8</font>, a byte-local loop program, into deterministic PRGs with final section addresses and runs it in x128 with result 15. A separate bounded <font name='NovaMono'>hello.n8</font> fixture emits and displays one string literal. These are real milestones, but they do not yet exercise the complete object/interface example above.",
- ))
-
- story += h1("8. Diagnostics and resource limits")
- story.append(h2("Diagnostic contract"))
- story.append(p(
- "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.",
- ))
- story.append(code(r"""
- E014 TEST.N8 23 7
- BYTE EXPECTED; WORD FOUND
- """))
- story.append(data_table(
- ["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"],
- ],
- [1.4 * inch, 5.5 * inch],
- ))
- story.append(h2("Verified limits in this snapshot"))
- story.append(data_table(
- ["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"],
- ],
- [1.55 * inch, 5.35 * inch],
- ))
- story.append(PageBreak())
-
- story += h1("9. Compiler architecture")
- story.append(h2("Execution boundary"))
- story.append(p(
- "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.",
- ))
- story.append(h2("Three-pass design"))
- story.append(data_table(
- ["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"],
- ],
- [1.4 * inch, 3.8 * inch, 1.7 * inch],
- ))
- story.append(h2("Memory strategy"))
- story.append(data_table(
- ["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"],
- ],
- [1.7 * inch, 5.2 * inch],
- ))
- story.append(h2("Banking and KERNAL discipline"))
- story.append(p(
- "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.",
- ))
- story.append(PageBreak())
-
- story += h1("10. Implementation status")
- story.append(callout(
- "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.",
- "info",
- ))
- story.append(Spacer(1, 8))
- story.append(status_table([
- ("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"),
- ]))
- story.append(PageBreak())
-
- story += h1("11. Current verification evidence")
- story.append(p(
- "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.",
- ))
- story.append(data_table(
- ["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"],
- ],
- [1.55 * inch, 5.35 * inch],
- ))
- story.append(h2("Current audit caveat"))
- story.append(p(
- "A November 20 spot-check of <font name='NovaMono'>verify-counter-test.ps1</font> built the current sources and reached the test mailbox, then failed in cleanup with <font name='NovaMono'>x128 did not exit</font>. 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.",
- ))
- story.append(callout(
- "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.",
- "risk",
- ))
- story.append(h2("Planning progress by epic"))
- story.append(data_table(
- ["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"],
- ],
- [3.1 * inch, 0.8 * inch, 0.8 * inch, 1.0 * inch],
- ))
- story.append(PageBreak())
-
- story += h1("12. What needs to be worked on")
- story.append(h2("Priority 1 - close the source-to-code gaps left by E04"))
- for item in [
- "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.",
- ]:
- story.append(bullet(item))
-
- story.append(h2("Priority 2 - finish arrays and bounds behavior"))
- story.append(p(
- "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.",
- ))
-
- story.append(h2("Priority 3 - implement interface polymorphism"))
- story.append(data_table(
- ["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"],
- ],
- [1.0 * inch, 5.9 * inch],
- ))
-
- story.append(h2("Priority 4 - produce the real compiler application"))
- for item in [
- "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.",
- ]:
- story.append(bullet(item))
- story.append(PageBreak())
-
- story += h1("13. Integration, hardening, and release work")
- story.append(h2("Editor and compiler workflow"))
- story.append(p(
- "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.append(data_table(
- ["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"],
- ],
- [1.0 * inch, 5.9 * inch],
- ))
- story.append(h2("Regression and release") )
- for item in [
- "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.",
- ]:
- story.append(bullet(item))
-
- story.append(h2("Recommended milestone sequence"))
- story.append(code(r"""
- 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
- """))
- story.append(PageBreak())
-
- story += h1("14. Open decisions and risks")
- story.append(data_table(
- ["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"],
- ],
- [1.45 * inch, 2.55 * inch, 2.9 * inch],
- ))
- story.append(h2("Scope guardrails"))
- story.append(p(
- "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.",
- ))
- story.append(PageBreak())
-
- story += h1("Section 15 - Current practical workflow")
- story.append(h2("Front-end edit/check demonstration"))
- story.append(p(
- "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.",
- ))
- story.append(code(r"""
- cd newLang
- pwsh -File scripts/demo-write-check.ps1
- """))
- story.append(h2("Current end-to-end code-generation demonstration"))
- story.append(p(
- "The Counter verifier builds the on-machine compile fixture, compiles <font name='NovaMono'>counter.n8</font> twice, checks byte-identical PRGs and the final MAP, then runs the generated program. Its completed claim records result 15 and zero size mismatches.",
- ))
- story.append(code(r"""
- cd newLang
- pwsh -File scripts/verify-counter-test.ps1
- """))
- story.append(h2("What does not work yet"))
- story.append(p(
- "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.",
- ))
- story.append(h2("Safe disk rule"))
- story.append(callout(
- "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.",
- "risk",
- ))
- story.append(PageBreak())
-
- story += h1("Appendix A - Source documents reviewed")
- sources = [
- ("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"),
- ]
- story.append(data_table(["Repository source", "Used for"], sources, [2.55 * inch, 4.35 * inch]))
- story.append(h2("Snapshot caveat"))
- story.append(p(
- "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.",
- ))
- story.append(Spacer(1, 10))
- story.append(callout(
- "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.",
- "good",
- ))
- return story
-
-
- def main():
- OUT.parent.mkdir(parents=True, exist_ok=True)
- doc = NovaDocTemplate(
- str(OUT),
- pagesize=letter,
- rightMargin=48,
- leftMargin=48,
- topMargin=56,
- bottomMargin=52,
- title="Nova128 Language Reference and Implementation Status",
- author="Codex - repository audit",
- subject="Nova128 language and compiler implementation status as of 2026-11-20",
- )
- # Keep identical frame geometry across templates. BaseDocTemplate can revisit
- # the first template while laying out explicit page breaks; identical frames
- # prevent content from ever entering the decorative title-page bleed area.
- title_frame = Frame(doc.leftMargin, doc.bottomMargin, doc.width, doc.height, id="title")
- content_frame = Frame(doc.leftMargin, doc.bottomMargin, doc.width, doc.height, id="content")
- doc.addPageTemplates([
- PageTemplate(id="title", frames=[title_frame], onPage=draw_title_page),
- PageTemplate(id="content", frames=[content_frame], onPage=draw_content_page, autoNextPageTemplate="content"),
- ])
- doc.multiBuild(build_story())
- print(str(OUT))
-
-
- if __name__ == "__main__":
- main()
|