| Age | Commit message (Collapse) | Author |
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
ParseFunctionBody() scopes the prototype's pack parameters, parses the
body up to ENDFUNCTION/ENDPROCEDURE, reports the same "expected ..."
diagnostic and builds the FunctionDefAST for both declaration forms.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
ParseOperatorName() takes an optional int * so callers that ignore the
operator token no longer declare a dummy. The identical identifier-or-
OPERATOR prologues of assignment, identifier-expression and CALL parsing
move into ParseCalleeName().
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
getNextToken() now returns void since no caller reads its result, and
GetTokPrecedence() does a single map lookup without the unreachable
non-positive precedence check. Unused <cstdio>, <set> and FunctionAST.h
includes are dropped.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
Lexer, parser, driver and codegen diagnostics now read
"<path>:<line>: error: <message>" instead of "error: <message> at line N
in <path>". The path is always printed as given on the command line.
Call sites pass the bare message to cps::sourceError/sourceWarning, which
carry printf format checking; reportError routes through the same helper.
The suite iii harness parses the new layout and matches the reason
against the message only. iii/template-class-pack-field passed only
because its reason regex matched the case path, so it is now
case-insensitive.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
Select member and global candidates together, enforce private access, and
reuse argument marshalling. Materialize temporary receivers for chaining
and register them for the existing object cleanup mechanism.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
Resolve exact operand types and preserve declared operator return types.
Reject implicit STRING to BOOLEAN conversion at typed expression boundaries.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
Retain parameter source lines for warnings and preserve field access
prefix validation when distinguishing fields from methods.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
|
Use standard WHILE headers and default-public class fields, resolve
pseudocode identifiers without case sensitivity, and check signed i64
literal boundaries before conversion. Preserve source locations across
recursive emission and function diagnostics.
Add 22 regression cases and update compiler examples and documentation.
Validated all 69 CTest entries with the original Linux Actions seed and
verified the release package's embedded, native and IR output paths.
|
|
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
|
Add TRY/CATCH/ENDTRY and anonymous THROW statements. Use LLVM exception
handling and the C++ ABI to propagate exceptions across function calls,
clean up catch state, and handle uncaught exceptions at the program boundary.
Register exception runtime symbols for the statically linked embedded runner.
Verify runtime checks, nested catches, returns, loops, and invalid syntax
with smoke programs; exercise unwinding with MCJIT, lli, and native binaries.
BREAKING CHANGE: Runtime check failures now throw anonymous exceptions and
print only a generic message when uncaught. Native binaries require linking
the C++ runtime.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
|
Review findings (all reproduced, then fixed and re-verified):
- '^x' leaked as a raw address into any builtin context (s <- ^x printed
the variable's bytes as a C string; NOT ^x, '&', and ^x = ^x compiled).
Address-of is now rejected everywhere except a pointer-typed target.
- A whole-array variable passed the nominal gate as a value of its
ELEMENT type (s <- arrayOfSeason stored the raw data pointer; = on it
emitted invalid IR). Whole arrays are now rejected as operands and as
coercion sources; array parameters are unaffected.
- Enum values smuggled into INTEGER through array subscripts and DECLARE
bounds (a[Autumn], ARRAY[Spring:Winter]); both now go through
emitCoercedExpr like every other INTEGER context.
- An array DECLAREd inside an IF/WHILE/REPEAT/FOR body and used after the
block was a wild-pointer write (constant bounds) or a verifier dump
(runtime bounds). Arrays are now block-scoped: control-flow bodies
snapshot and restore the ArrayTable, so escape is a clean compile error.
- Duplicate parameter names silently shadowed (BYREF write-back defeated);
now a parse error. Trailing comma in parameter lists accepted; now a
parse error consistent with every other list.
- A variable/array/parameter/function could reuse a TYPE name; reserved.
- RETURN with a value inside a PROCEDURE was silently discarded (control
did not return); now an error, as is a bare RETURN in a FUNCTION.
- INPUT r.f mis-parsed into a three-error cascade; now one clear error.
- Assigning to an enum constant now says so instead of 'Unknown variable'.
Docs: ARCH/CONVENTIONS/EXTENDING/SUBSYSTEMS/PITFALLS rewritten for the
TYPE system (ABI additions, nominal-typing invariants, admission-gate
doors, array-parameter ABI, new recipes, new sharp edges); README
features/TODO updated โ random files are unblocked.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
- Parameter syntax lands end-to-end: ARRAY OF T (rank 1, bounds travel
with the argument) and ARRAY[l:u,...] OF T (any rank, literal bounds as
a checked contract). Element type and rank must match exactly.
- Flattened ABI: each rank-R array parameter becomes a data pointer plus
kBoundArgsPerDim i64 bounds per dimension. The callee rebuilds
ArrayMetadata from those bounds (ArrayHandler::bindArrayParameter via a
binder callback injected by CodeGen, so FunctionGen stays ignorant of
the array subsystem); the checked-indexing pipeline is reused unchanged.
- BYVAL (the CIE default) copies the whole buffer at callee entry
(malloc+memcpy, never freed โ consistent with the string policy) so
callee writes stay invisible; BYREF binds the caller's buffer.
- Bounded-parameter contract: compile-time comparison when the caller's
bounds are constants, else a runtime [Fatal] check
(RuntimeCheck::emitArrayArgBoundsCheck).
- marshalCallArgs gains the array branch and a call-site line number
(CallStmtAST now carries one); whole-array-to-scalar keeps a clear
error, FUNCTION RETURNS ARRAY is a dedicated parse error.
- Verified: BYREF fill/sort-style mutation, BYVAL copy invisibility,
2-D bounded params, ARRAY OF <record> with field writes through the
parameter, bounds-contract mismatches at compile time and run time.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
- Reserve TYPE/ENDTYPE/SET/DEFINE (-600 token block); SET/DEFINE parse to
dedicated not-implemented errors (RANDOM precedent).
- New TypeAST.h: enum/pointer/record decl nodes, designator chain
(DesignatorExprAST + Index/Field/Deref accessors), AddrOfExprAST,
DesignatorAssignStmtAST. Bare-name and single-index shapes degrade to
their legacy nodes, so existing programs produce identical ASTs.
- ParserType.cc: TYPE declarations (top-level only, enforced via a
ParseBlock depth counter), DECLARE-only record bodies with local
field-level error recovery.
- Postfix [ ] . ^ chain in ParseIdentifierExpr; prefix ^ (address-of,
designator operand only) in ParseUnary; assignment targets rebuilt on
the same suffix parser.
- Parameters: ParamDecl{name, type, mode, array rank/bounds} replaces the
(name, type, byref) tuple. Pass mode is sticky across parameters and
BYREF is rejected in FUNCTIONs, both per guide ยง8.3 (the old per-param
reset made the guide's own SWAP example pass Y by value). ARRAY OF T /
ARRAY[l:u,...] OF T parameter syntax parses; codegen rejects it until
the parameter-passing phase lands.
- CodeGen stubs report clear not-implemented errors for the new nodes so
nothing is silently ignored.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
Confirmed by a 17-agent review pass over the refactor diff (12 findings
verified against the code and reproduced end-to-end):
- marshalCallArgs: BYREF arguments must match the declared parameter
type exactly (was: silent bit-reinterpretation, e.g. REAL passed to
BYREF INTEGER printed garbage with exit 0); whole-array arguments are
rejected (was: callee assignment smashed the array data pointer ->
runtime SIGSEGV)
- Null guards for CHR/LCASE/UCASE/IS_NUM/NUM_TO_STR/STR_TO_NUM/ASC
argument emission (was: compiler SIGSEGV on e.g. CHR(undeclared)),
matching the guards MID/RIGHT/LEFT already had
- ParseReturnStmt: propagate expression-parse failure (was: diagnostic
printed but exit 0) and recognize bare RETURN before
ENDWHILE/UNTIL/NEXT (was: bogus diagnostic on legal early return)
- emitPrototype rejects FUNCTION/PROCEDURE names that collide with
runtime/libc symbols (was: FUNCTION strlen silently hijacked the
string runtime; arity mismatch crashed createArgumentAllocas) or with
builtins (was: silently shadowed); conflicting redefinitions keep the
first signature
- FOR STEP is evaluated exactly once, before the loop (was: once per
iteration; the runtime-direction refactor had moved it to N+1)
- RETURN values are coerced to the declared return type via the
signature table (RETURN n in a RETURNS REAL function now compiles)
- '&' coerces its operands to STRING (CHAR/number operands work);
OUTPUT of a PROCEDURE call reports a clean error
AGENTS docs updated to match. All positive samples remain byte-identical
to the pre-refactor baseline.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
Seven copy-pasted statement-block loops collapse into
ParseBlock(terminators); five comma-separated expression-list loops
collapse into ParseExprList(close, allowEmpty), which also fixes
"arr[1 2] <- x" being silently accepted as arr[1,2] on the statement
path. Error recovery now lives in one place: syncToStatementStart skips
to the next statement-start/block-end token, so a bad statement no
longer swallows the first token of the following good one. Drop the
dead -1000/-1001 token check in ParsePrototypeArgs.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
- MID/RIGHT/LEFT integer args now coerced at call sites (RIGHT(s, n/2)
no longer emits invalid IR); drop emitLeft's private conversion
- FOR loop direction decided at run time via select on STEP sign;
descending FOR works, STEP evaluated once per iteration
- ArrayHandler: extract emitCheckedIndices/loadElement; index count is
validated before emission, fixing a compiler-crash (vector OOB UB) on
OUTPUT with too many indices
- Error contract: Lexer/Parser/CodeGen track errors; all silent failure
paths now print Error: diagnostics with line numbers; unterminated
char literal no longer truncates the rest of the program; module is
verified with verifyModule; driver exits non-zero on any error
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
|
|
|