Retire the byte-for-byte fidelity constraint, and fix what it was blocking

The Go reference is deprecated and will not be updated, so the two projects
are no longer required to match. Recorded as TODO.md section 0.1, first thing
in the file, because it silently reverses the premise several later sections
were written on -- an agent reading section 6 without it will park work that
is no longer blocked.

Section 6 item 16 was the item waiting on exactly this and is now fixed: the
keyword tables are searched on the base name with any type suffix stripped, so
PRINT$, LEN# and GOTO% are refused as variable names and the reference's own
diagnostic stops being dead code. It cost the one golden case predicted, and
the cost was nothing -- renaming a variable in strreverse.bas left its expected
output byte-for-byte unchanged.

AKBASIC_KNOWN_FAILING_TESTS is empty as a result and known_reference_defects.c
is gone. Section 6 items 1-9 and 11 are reopened as an ordinary defect list.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-31 12:52:00 -04:00
parent eb5374d212
commit 583c0abbd2
9 changed files with 205 additions and 127 deletions

View File

@@ -224,10 +224,12 @@ static akerr_ErrorContext *match_identifier(akbasic_Runtime *obj)
{
PREPARE_ERROR(errctx);
char lexeme[AKBASIC_MAX_LINE_LENGTH];
char basename[AKBASIC_MAX_LINE_LENGTH];
const akbasic_Verb *verb = NULL;
void *fndef = NULL;
bool userfunction = false;
char c = '\0';
size_t used = 0;
obj->tokentype = AKBASIC_TOK_IDENTIFIER;
while ( !is_at_end(obj) ) {
@@ -260,13 +262,21 @@ static akerr_ErrorContext *match_identifier(akbasic_Runtime *obj)
}
PASS(errctx, get_lexeme(obj, lexeme, sizeof(lexeme)));
/*
* Searched with the type suffix still attached, which is the reference's
* rule (basicscanner.go:349) and is why the "Reserved word in variable name"
* branch below is unreachable -- TODO.md section 6 item 16, which explains
* why it is still here rather than fixed.
* The verb table is searched on the *base* name, with any type suffix
* stripped. The reference searches with the suffix still attached
* (basicscanner.go:349), so `PRINT$` misses every table, the "Reserved word
* in variable name" branch below is dead code, and `PRINT$ = 1` is quietly
* accepted as an ordinary string variable. TODO.md section 6 item 16.
*/
PASS(errctx, akbasic_verb_lookup(lexeme, &verb));
strncpy(basename, lexeme, sizeof(basename) - 1);
basename[sizeof(basename) - 1] = '\0';
used = strlen(basename);
if ( obj->tokentype != AKBASIC_TOK_IDENTIFIER && used > 0 ) {
basename[used - 1] = '\0';
}
PASS(errctx, akbasic_verb_lookup(basename, &verb));
ATTEMPT {
CATCH(errctx, akbasic_environment_get_function(obj->environment, lexeme, &fndef));