Adds InputInterpreterTests with:
- Arithmetic cases including precedence, hex/binary, exponent.
- Comparisons yielding numeric booleans.
- Variable assignment (::) and persistence across calls; unknown variable soft error.
- Expression binding (:=) re-evaluated at use-time; invalid expression soft error.
- Array assignment (->) and indexing; out-of-range and index-expression scenarios.
- String literal used as expression soft error.
- Divide-by-zero soft error (no thrown exception).
- LastExecutionTime measured across calls.
Each test asserts both the return value and NumericValue/StringValue for consistency.
Implements developer-facing Interpret API that:
- Parses and executes input via generated Scanner/Parser and current interpreter state.
- Returns the numeric result (decimal) and updates NumericValue/StringValue.
- Emits soft errors: never throws; on error sets NumericValue=0 and StringValue to parser error format or exception message.
- Restores LastExecutionTime measurement for the previous interpretation.
This preserves the original nomenclature while aligning to v2’s FunctionValue model.
Add in-memory stores and APIs required by the v2 Coco/R grammar:
- Variables: AssignNumeric, AssignExpression, AssignNumericArray; TryGetNumeric, TryGetExpression, TryGetNumericArray.
- Mixed-arg function dispatch: ExecuteFunction(name, FunctionArgument[]), plus RegisterFunction.
- Expression evaluation for :=: EvaluateExpression(expressionText) via generated Scanner/Parser with a child interpreter sharing stores.
- Output handling preserved: ProduceOutput(FunctionValue) updates NumericValue/StringValue.
These changes allow the generated parser to compile and run against the v2 runtime, enforcing the numeric-first, strings-as-arguments-only model.
This completes the v2 grammar based on master’s capabilities while aligning with the v2 design philosophy (numeric-first, strings as function-args only):
- Implement full arithmetic grammar ( +, -, *, /, %, ^, parentheses, unary sign ), with support for number/hex/binary literals.
- Add variables and arrays:
- Numeric variables via :: (evaluate RHS now and store numeric)
- Expression-bound variables via := (capture RHS text; re-parse and evaluate at use-time)
- Numeric arrays via -> and array literals + indexing (with bounds/type checks)
- Add comparisons (==, <, >, <=, >=) producing FunctionValue TRUE/FALSE.
- Add function calls with mixed arguments: numeric expressions and quoted string literals.
- In numeric contexts, enforce numeric results; emit clear type errors if a function returns a string.
- Root production always produces a FunctionValue through InputInterpreter.ProduceOutput(FunctionValue).
Runtime integration (expected APIs on InputInterpreter):
- Variable APIs: AssignNumeric, AssignExpression, AssignNumericArray; TryGetNumeric, TryGetExpression, TryGetNumericArray
- Function dispatch: ExecuteFunction(name, FunctionArgument[])
- Expression evaluation for :=: EvaluateExpression(expressionText)
Coco/R build fix:
- Correct the PreBuild command in src/core/core.csproj:
- Use -frames (without the stray space) and point to cocor
- Use the correct case and path for the grammar: cocor/Interpreter.atg
Notes:
- Strings are valid only as function arguments and not as standalone values or variables.
- Grammar emits concise, actionable error messages for type mismatches, missing variables, and array bounds.