Conversation
- Add REPL mode (./Falcon repl) with multi-line brace tracking and error recovery - Rename builtins.go → deffuncs.go; extract numops.go for base conversions, colour, random, stats and base-format predicates (isBase10/isHex/isBinary) - Add print.go with printLine/stub helpers; remove fmt from entire runtime package - Merge private eval() into public Eval(); rename storedProc → Procedure - Add evalExprs() helper and use it consistently across deffuncs/methods/interpreter - makeDictionary now accepts any two-element list as a key-value pair, not just Pair AST nodes - Fix + operator to be strictly numeric; string join is _ only - Lexer: support leading-dot decimal literals (.5, .123 → 0.5, 0.123) - App Inventor component stubs now print informative messages instead of silently returning null - Pair evaluation returns [key, value] two-element list Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…d names - AsBool() now panics on non-Bool types (no implicit number/string truthy) - AsNum() drops Bool coercion, panics on non-numeric types - AsStr() default falls back to String() instead of empty string - TryNum renamed to CoerceNum across value.go, interpreter.go, methods.go, numops.go - Internal interpreter helpers renamed for clarity (evalBinary→binary, evalIf→ifExpr, etc.) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All statement forms (if, for, while, each, eachPair, set, proc defs, list/dict mutations, component events/property sets, println) now return VoidVal() which panics if consumed as an expression. REPL skips printing void results. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tions Custom xorshift64 RNG replaces math/rand. insertionSort (stable) replaces sort.SliceStable/sort.Slice. Hand-rolled CSV helpers replace encoding/csv. Also renames: deffuncs→def_funcs, numops→num_helper, interpreter→runtime. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…412) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…18 + MASTER_REASON.jsonl) Add final chunks 14-18 (450 entries, idx 1413-1863) with verbose <think> reasoning traces grounded in correct Falcon syntax (textLen, listLen, add, containsItem, for-in loops, segment(from,length), boolean sort comparators, println, etc.) drawn from README and MASTER.jsonl ground truth. Merge all 19 chunks into answer_reasoning/MASTER_REASON.jsonl (1850 pairs total). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ntax - swap_failing_code.py: replaces 106 unparseable code blocks with validated equivalents from MASTER.jsonl (matched by user prompt) - apply_thinks.py: rewrites the <think> reasoning traces for those 106 entries so they describe the actual code rather than the discarded buggy version - normalise_syntax.py: round-trips all 1850 code blocks through `Falcon format` (lex → parse → AST.String()), normalising whitespace and style consistently - fix_remaining.py: regex-based targeted fixer for common grammar errors - MASTER_REASON_a.jsonl: snapshot of the original pre-revision version Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
BinaryExpr.String() was not wrapping non-continuous operands (e.g. SimpleIf/if-else expressions) in parentheses, causing the formatter to emit ambiguous output like `if (c) "x" else "y" _ z` instead of `(if (c) "x" else "y") _ z`. This produced invalid code on round-trip. Fix: wrap any operand where !Continuous() in parens, not just *BinaryExpr operands with lower precedence. Re-ran normalise_syntax.py — 295 entries updated, 0 failures across all 1850 entries. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- smart_body.go: handle *variables.Var as doResult when doBody is non-empty,
avoiding "Cannot include a statement for the required variable result" panic
- MASTER.jsonl: fix 12 entries with operator precedence bugs (!x === y),
a nested-{} parse error, and modulo precedence issues; all 1864 now pass
- testing/{run,hi}.mist: update test files
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Parser: funcSmt was entering ScopeSmartBody for returning procedures, bypassing the existing depth-1 guard in checkScope. Changed to ScopeRetProc so nested func definitions now panic at parse time. MASTER.jsonl: lifted inner functions to top-level in entries 1, 201, 871, 1861, 1862. nQueens/solve gained an explicit `n` param since it previously captured it from outer scope. All 5 verified to run correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- VarResult.String() no longer emits its own { } wrapper; output is flat
- RetProcedure.String() wraps VarResult (and Do) results in { } block
- SmartBody.mutateVars() hoists SimpleVar to DECL before createDoSmt
- if_expr.go: force braces on multi-line / dict-starting then/else branches
- lang_parser.go: ifSmt() expects ( ) around conditions; remove debug print
- main.go: add reformatStdin() for Blockly roundtrip test command
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
[ and ( on a new line were incorrectly treated as index access / function call continuations of the previous expression. Added isOnNewLine() helper that compares Token.Column values; guards added in element() for OpenSquare and checkCall() for OpenCurve. Also removed stray debug println in local_result.go. Verified all 1864 MASTER.jsonl programs pass both half and full cycles. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Introduces classify_curriculum.py which assigns each MASTER.jsonl entry to a complexity level (1-6) using brace-matched AST heuristics (nested loops, recursion, lambdas, multi-func). Outputs level_N.jsonl files and a combined curriculum.jsonl sorted L1→L6 for progressive fine-tuning. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Runtime panics now surface like parse errors: a decorated box shows the offending source line with a caret under the exact token. - Interpreter tracks lastToken/lastHighlight updated in Eval for every node that carries a Where field (BinaryExpr, FuncCall, Question, method.Call, variables.Get, list.Get/Set, Transformer, procedures.Call, For, While, Each, EachPair) - list.Get/Set caret spans the full [index] expression, not just '[' - FormatRuntimeError() uses BuildErrorHighlight() for custom-width carets - runProgram() recover() replaced raw Go stack dump with formatted error - Added Where *lex.Token to 7 AST nodes that previously had none; parser captures for/while keyword tokens and '[' instead of skipping Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Type mismatch panics now report the actual value received so users know exactly what went wrong instead of a bare "expected a list value". Method arg-count errors include the full signature with parameter names. Unknown method errors identify the receiver type. Empty-collection errors explain the constraint. No fmt usage — strconv only. Also adds roundtrip subcommand with stage-specific exit codes (1/2/3) to distinguish mist-parser, blockly-serializer, and blockly-parser failures. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All bare panic(errorMessage) calls in AST Blockly()/Signature() methods that had a Where token available now use token.Where.Error() instead, so errors show the offending source line and caret rather than a plain string. Also fixes a copy-paste bug in dict.go that said "Unknown text method" instead of "Unknown dict method". Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Parser was treating any method call followed by '{' as a transformer.
Now checks both name and arg count against transformer signatures via
IsTransformer(name, argCount) before entering transformer path.
Also adds .segment() hint when text is subscripted with [index].
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
yield now only works inside result (= { }) functions; void procedures
revert to returning VoidVal. README updated with yield semantics,
first_divisible example, and guard clause pattern. Test file updated
to use = { } syntax throughout.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.