Commit Graph
153 Commits
Author SHA1 Message Date
coolguy ff98176cc2 Merge branch 'master' into m7-trial 2026-08-16 23:30:36 +09:00
coolguyandClaude Opus 5 0a434d8a9a spec: record why the try rule cannot be enforced yet
SPEC.md allows `try` only inside a function returning an error union, but
check.c only tests it in the FE_N_EXPR_STMT case, so `var x = try e;` and
`x = try e;` walk straight past. m5/owned.fe and m5/runtime.fe both depend on
that gap.

Moving the check onto the try expression is a four-line change and it is
correct, but it cannot land yet. runtime.fe's `run` allocates and returns a
value, so closing the hole forces it to return an error union -- and master
rejects `return <value>;` in `-> !i32` ("return type mismatch") as well as a
bare `return;` in `-> !void` ("void expression returned from value function").
Both need contextual success construction, which is M7 work. `catch` and
`@trap()`, the two spellings SPEC offers as alternatives, are also M7-only, so
there is no way to express `run` legally on master today. All three paths were
tried in DOSBox-X, not assumed.

Fix owned.fe now, since `main() -> !void` is legal today and matches
m4/try-fpr.fe, and leave the checker alone until M7 lands with the rest.

Verified: 155 passed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BScg8CF1sAAM2zVHAu5zvW
2026-08-16 23:23:47 +09:00
coolguy 9e074e2e16 Merge branch 'master' into m7-trial 2026-08-16 23:09:39 +09:00
coolguyandClaude Opus 5 86bff9a06d dev: capture compiler diagnostics under DOS
Every fec error message was written to stderr, and COMMAND.COM can only
redirect handle 1 -- ">" is the whole vocabulary, "2>" is not parsed at all.
So a failing compile recorded exit code 1 and a zero-byte log, and the actual
message went to a screen nobody reads. Confirmed directly: `FEC.EXE --check`
on a fixture that must fail produced rc=1 and 0 bytes of stdout.

That is why an unexpected compiler failure was undiagnosable. It also means
the M6 reject cases have only ever asserted "exit code was nonzero" -- the
error text they nominally check has never been observable to the runner.

Add fe_diag_stream(), which resolves once to stdout when FE_DIAG_STDOUT is set
and stderr otherwise, and route diag.c and driver.c through it. The default is
unchanged, so interactive use keeps writing to stderr; the runner sets the
variable in RUN.BAT. The stderr references in check.c and emit_c.c are the
Ferro language's own std.io.stderr writer and are deliberately untouched.

Verified in DOSBox-X: 155 passed. A rejecting compile now records its message,
source excerpt and caret in RESULTS\<key>.LOG.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BScg8CF1sAAM2zVHAu5zvW
2026-08-16 23:09:30 +09:00
coolguy e457ee46b2 Merge branch 'master' into m7-trial 2026-08-16 23:02:43 +09:00
coolguy 7a25447281 trial: unblock the DOS build (local only, not for merge) 2026-08-16 23:02:43 +09:00
coolguyandClaude Opus 5 8b7d6a8d09 dev: make DOS build failures diagnosable
Reviewing an M7 branch took six DOSBox-X runs to find three build blockers
that each take a second to explain. The runner threw away everything needed to
see them.

Capture the compiler build's output. Case commands were redirected to
RESULTS\<key>.LOG but `call BUILD.BAT` was not, so the step that fails first
and blocks every case left only BUILD.FAIL containing the string "FAIL". The
twelve wcl invocations inside it were invisible; finding "Unable to open
src\emit_c_m7.c" meant hand-editing build-dos.bat to add a redirect and
re-running the VM.

Record exit codes. The batch collapsed every outcome to `if errorlevel 1`, so
a compiler that aborted and one that exited 1 with a diagnostic were the same
FAIL. RC.BAT now walks a descending errorlevel ladder into RESULTS\<key>.RC
and the host derives pass/fail from it, which immediately separates an
ordinary rejection (1) from a trap (255). Note the space in `echo 0 >FILE`:
without it DOS parses `0>` as a redirect of handle 0.

Stop falling back to CONSOLE.LOG. That is DOSBox-X's own log -- display
enumeration and INT15 chatter -- so a crashed command reported fifty lines of
emulator noise instead of saying it produced no output.

Add tools/tests/test_dos_names.py. An over-long source name reaches the DOS
build as `Unable to open "src\..."`, which reads as a missing file rather than
a name FAT cannot represent, and only after a VM boot and ten object builds.
The check runs on the host in 0.03s and flags emit_c_m7.c (9-character stem)
on the branch that prompted this.

Also pass -k through to pytest so a single case can be re-run without its
whole milestone, and print the resolved ROOT at startup: an editable install
plus a git worktree will otherwise silently build a different checkout than
the one the shell is in.

Verified on master: 155 passed, unchanged. Recorded codes are 0 for success,
1 for rejections, 255 for the three bounds traps.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BScg8CF1sAAM2zVHAu5zvW
2026-08-16 23:02:28 +09:00
coolguy 63bc8e8724 Merge branch 'master' into m7-trial 2026-08-16 22:37:51 +09:00
coolguyandClaude Opus 5 5529e3dc14 test: prove --no-checks removes the bounds check
The bounds-no-checks cases emitted and built but never ran, so they only
proved that --no-checks produces compilable C -- not that it removes the
check, which is the entire point of the flag.

A run case could not simply be appended. BOUNDS.FE returns the out-of-bounds
element directly, so with checks removed its exit code is whatever sits past
the array on the stack and there is no correct status to assert. Asserting on
the generated C instead does not work either: emit_c.c defines fe_trap_bounds
unconditionally and --no-checks only suppresses the call sites.

Add NOCHK.FE, which reads one element past a [2]i32 and returns x - x. That
is 0 for whatever garbage the unchecked read produced, so the same source has
a defined outcome both ways: compiled with checks it must trap, compiled with
--no-checks it must run to completion and exit 0. Register both halves and
drop the two BOUNDS-N cases they supersede.

Verified in DOSBox-X: 155 passed, including m3-nochk-trap failing as expected
and m3-nochk-off-run succeeding.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BScg8CF1sAAM2zVHAu5zvW
2026-08-16 22:23:41 +09:00
coolguy 594704a07d dev: promote DOSBox-X and remove QEMU support 2026-08-16 22:14:50 +09:00
coolguyandClaude Opus 5 4ad3e3097b refactor: derive the milestone bounds from the registry
The highest supported milestone was spelled out in six places across four
files: range(1, 7) and default="m6" in test_cli.py, the same pair in
test_milestones_dosboxx.py, and through=6 in both registry.py and suite.py.
Registering M7 meant finding all six, and missing one failed silently.

Derive MAX_MILESTONE and MILESTONES from CASES instead, and move the mN
selector parser to registry.milestone_number so the pytest module stops
carrying its own copy. Adding cases for a new milestone is now enough for
ferro-test to accept --through/--only for it.

No behaviour change: MAX_MILESTONE evaluates to 6, ferro-test still advertises
{m1..m6} with default m6, and the case snapshot is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BScg8CF1sAAM2zVHAu5zvW
2026-08-16 22:11:36 +09:00
coolguyandClaude Opus 5 c25312135d refactor: rebuild the milestone registry as a table
registry.py was literally `cat registry_m1_m3.py registry_m4_m6.py`, which
left a duplicate `_c` definition and a stray module-level docstring at the
seam. Replace the hand-rolled append loops with five builders -- _emit, _wcl,
_triple, _rejects, _dump_ast -- and express the cases as one ordered list.

The irregularities are now parameters instead of one-off code, each with the
reason recorded:

- _triple(stem=) for M2 castwhil emitting CAST16
- _triple(build_source=) for M4 prop, which emits PROP.C but compiles
  PROPTEST.C because that file #includes it
- _triple(run_suffix="trap", run_ok=False) for the M3 bounds cases
- _triple(emit_suffix=None) for M4, whose ids lack the -emit suffix
- _emit(output_first=True) for M6, which passes -o before the input

The three scattered 8.3 output-name mappings collapse into one _OUT83 table
keyed by (milestone, name). The key needs both: bad-type is BAD-TY in M2 but
BAD-TYP in M4, and bad-cond is BAD-CO in M2 but unshortened in M5. Values are
carried over verbatim -- the shortenings are inconsistent and several were
never required, but that is a separate decision.

suite.py keeps only Case and drops the all_cases forwarder, so the
registry -> suite -> registry cycle is gone along with the function-scoped
import that worked around it. dosboxx.py still imports Case from suite and is
untouched.

Verified behaviour-preserving by snapshotting (id, milestone, command,
expect_success) for all 150 cases in order before and after: diff is empty.
pytest collects the same 151 items.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BScg8CF1sAAM2zVHAu5zvW
2026-08-16 22:11:13 +09:00
정시원 f946b14bde fix: keep M7 return context through if branches 2026-08-16 22:09:04 +09:00
정시원 24a99abd37 restore M7 fixture README 2026-08-16 22:01:07 +09:00
정시원 abbfdb3092 remove temporary M7 smoke workflow 2026-08-16 22:00:59 +09:00
정시원 7d76167179 document M7 smoke coverage 2026-08-16 21:57:34 +09:00
정시원 bdb307ffcc ci: focus M7 smoke on build errors 2026-08-16 21:56:18 +09:00
정시원 594a837003 ci: smoke test M7 compiler branch 2026-08-16 21:55:41 +09:00
정시원 53f4d79c4f expose ownership flags to M7 emitter 2026-08-16 21:55:28 +09:00
정시원 a2d7dffcae wire M7 DOS build 2026-08-16 21:55:00 +09:00
정시원 1856e99a61 wire M7 checker and emitter 2026-08-16 21:54:50 +09:00
coolguy 0dada80e65 test: unify registry and capture Watcom diagnostics 2026-08-16 21:54:22 +09:00
정시원 8a2e6ddd1e implement M7 C emission 2026-08-16 21:52:57 +09:00
정시원 1e90eba1be implement M7 semantic checker 2026-08-16 21:44:46 +09:00
coolguy 3a7d7de0d3 test: add unified DOSBox-X milestone runner 2026-08-16 21:44:39 +09:00
정시원 369aeb3b86 initialize contextual semantic metadata 2026-08-16 21:42:29 +09:00
정시원 a32ad3182a carry contextual M7 type metadata 2026-08-16 21:42:20 +09:00
정시원 c5e2496415 remove temporary M7 ownership overlay 2026-08-16 21:40:31 +09:00
정시원 b79970241a extend ownership through M7 wrappers 2026-08-16 21:40:22 +09:00
정시원 e0232a3e92 extend ownership for M7 wrapper types 2026-08-16 21:37:31 +09:00
정시원 5be7a5b852 preserve optional if-let patterns 2026-08-16 21:35:11 +09:00
정시원 8e23a6269b implement M7 optional and nominal result types 2026-08-16 21:34:10 +09:00
정시원 8ac76aed39 extend M7 type construction 2026-08-16 21:33:02 +09:00
정시원 411c86afc2 extend M7 semantic helpers 2026-08-16 21:32:46 +09:00
정시원 8b1efe3562 complete M7 type metadata 2026-08-16 21:32:34 +09:00
정시원 aeec10af48 Merge pull request #8 from sebastianrcnt/agent/m7-core-foundation
add M7 semantic and cleanup foundation
2026-08-16 21:20:05 +09:00
정시원 d43f28d06a wire M7 foundation into DOS build 2026-08-16 21:17:57 +09:00
정시원 bc9792532d wire M7 foundation into host build 2026-08-16 21:17:45 +09:00
정시원 47ef8420a9 add optional type kind 2026-08-16 21:17:33 +09:00
정시원 8aae7d9a63 implement cleanup lowering plan 2026-08-16 21:17:15 +09:00
정시원 40ec131ffc add cleanup lowering plan 2026-08-16 21:16:46 +09:00
정시원 c4f3accbb3 implement M7 semantic foundation 2026-08-16 21:16:30 +09:00
정시원 9c3cae7406 add M7 semantic foundation 2026-08-16 21:16:14 +09:00
정시원 43fa9c9bc9 Merge pull request #7 from sebastianrcnt/codex/m6-borrow-checker
Implement M6 borrow checker integration
2026-08-16 20:49:38 +09:00
coolguy aba9370ea6 implement M6 borrow checker integration 2026-08-16 20:46:45 +09:00
정시원 db0ed4bbe0 Merge pull request #6 from sebastianrcnt/agent/m6-ownership-core
implement M6 ownership analysis core
2026-08-16 20:01:32 +09:00
coolguy 748505513d test: audit M6-M9 fixtures for v0.1.8 2026-08-16 20:00:27 +09:00
정시원 3bcf6a33f1 tighten M6 ownership core semantics 2026-08-16 19:59:01 +09:00
정시원 8c4ec8a6e6 complete M6 ownership core primitives 2026-08-16 19:58:18 +09:00
정시원 db2b681f6b implement M6 ownership core 2026-08-16 19:57:15 +09:00