summaryrefslogtreecommitdiff
path: root/src/core/token.c
AgeCommit message (Collapse)Author
2026-02-28modify headersHEADmasterPaul Buetow
2026-02-28Fix function body literal mutation: make examples passPaul Buetow
Two bugs combined to break uber.fy and any function called more than once: 1. Scanner split identifiers at '_' boundaries (e.g. arr_sum → arr + _sum). Fixed by adding d != '_' to the token-splitting guard condition so underscores are treated as part of identifiers. 2. Dead keyword TT_ARR reserved the name 'arr' as a keyword token, preventing its use as a function parameter. Removed TT_ARR from the enum, keyword table, and name table. 3. (Root cause of the assert failure) _var_assign stored the symbol for a newly declared variable pointing directly at the literal token from the function body token list. incr/decr modify tokens in place via stack_top, so a loop like `my i = 0; while i < n { incr i; }` would corrupt the body's '0' literal — on the next call i starts at 10 instead of 0. Fixed by allocating a fresh token_new_integer / token_new_dummy for TT_INTEGER and TT_DOUBLE initialisers so body literals are never mutated. Arrays and strings retain reference semantics unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28Remove dead token/symbol types and fix SYM_INLINEFUNCTION latent errorPaul Buetow
- Remove IS_A_FUNCTION/IS_NOT_A_FUNCTION macros from symbol.h: referenced non-existent SYM_INLINEFUNCTION enum value (latent compile error) and were never used anywhere in the codebase - Remove TT_BOOL from TokenType enum: marked "temporarily disabled" but unused for years; YAGNI - Remove TT_NOTEQ from TokenType enum: duplicate of TT_NEQ ("!="), never referenced - Remove IS_NON_TERMINAL/IS_NOT_NON_TERMINAL macros: referenced START_NON_TERMINALS/END_NON_TERMINALS sentinels that don't exist in the enum — would cause compile errors if ever used - Remove token_new_couble declaration (typo) and token_new_double implementation: function had no callers Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-19Rename func keyword to funPaul Buetow
Replace the `func` language keyword with `fun` throughout: update the scanner's string-to-token mapping, all .fy example scripts, and all documentation files (.txt, .pod, .tex, .man, .html). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-19Implement loop (infinite) and do...while/until loopsPaul Buetow
Completes the 'loop, next, break, do' TODO entry — break and next were landed in the previous commit; this adds the remaining two forms: - loop { body } — infinite loop; the only exit is break. Simpler than while/until since there is no condition expression to evaluate. - do { body } while expr; / do { body } until expr; — post-condition loop: body always executes at least once, condition is checked at the bottom of each iteration. Condition tokens are collected until ';' (mirrors _expression_get but stops at semicolon instead of '{'), then replayed each iteration using the same temp-stack/temp-iterator technique as while/until. Both break and next are supported. Token changes: TT_LOOP and TT_DO added to the keyword enum in token.h, registered in get_tt() and tt_get_name() in token.c. Add examples/loop_do.fy; expected output: 5 / 12 / 11 / 5. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2021-11-02move to codebergPaul Buetow
2021-04-29update URIsPaul Buetow
2008-12-15modified headersPaul Buetow
2008-12-15say foo[1] worksPaul Buetow
2008-11-09changed the src headers.Paul Buetow
2008-11-07one step further for arrays.Paul Buetow
2008-11-04fixed bugs which happened.Paul Buetow
2008-11-04big step forward for arrays in fype. Paul Buetow
2008-11-04astylePaul Buetow
2008-11-04array_delete_iterate implemented..Paul Buetow
2008-11-04array_new_sizePaul Buetow
array_new_copy implemented
2008-11-01modified headersPaul Buetow
2008-10-28initial references support.Paul Buetow
run "make headers"
2008-10-25small cosmetic fixesPaul Buetow
2008-10-25astyle.Paul Buetow
more BSD style in return (FOO);
2008-10-25make headersPaul Buetow
2008-10-20no lines longer than 80chars.Paul Buetow
2008-10-20Improved GC debugging.Paul Buetow
Debugging printings now labeled with DEBUG::$NAME::$ETC::..:
2008-10-19refs and symsPaul Buetow
2008-10-18examples work now againPaul Buetow
2008-10-18backdowngradePaul Buetow
2008-10-14run astylePaul Buetow
still lots of debugging to do.
2008-10-14GC removed, temporalyPaul Buetow
2008-09-16array progressPaul Buetow
2008-08-25bugs fixed, initial arrayPaul Buetow
2008-08-24some modsPaul Buetow
2008-08-23changed headersPaul Buetow
2008-08-23some enhancementsPaul Buetow
2008-08-08changed header.Paul Buetow
2008-05-15Moved stuff into trunk.Paul Buetow