Skip to content

Releases: aki-null/epsilon-script

v2.1.0

06 Dec 11:32
c504670

Choose a tag to compare

Added

  • NoAlloc Compiler Option: Blocks runtime heap allocations
    • Compiler.Options.NoAlloc flag throws RuntimeException for string concatenation and ToString() calls
    • Compile-time constants are optimized away and allowed
  • Single Quote String Literals: String literals can now use single quotes ('...') in addition to double quotes ("...")
    • Both quote styles are semantically identical
  • Modulo Assignment Operator: Added %= compound assignment operator for numeric types
  • Compile-Time Function Signature Validation: Function calls now validated earlier with better error detection
    • Constant expressions fully validated: func("test", 2.0) with signature func(string, int) now fails at compile time
    • Variable expressions partially validated: catches wrong parameter count and concrete type mismatches
      • func(x) fails when all overloads require 2+ parameters
      • func(2.0, x) fails when no overload accepts float at position 0

Changed

  • Exception Location Reporting: All exceptions now include precise source location information
    • Error messages include both line and column: "Runtime error at line 1, column 9: message"
  • Custom Function Error Messages: Improved clarity and debugging information
    • Function calls that fail now show available overloads and parameter type mismatches
  • Function Validation Timing: Type mismatches in function calls with constant parameters now detected at compile time
  • Custom Function Registration: Functions with mismatched precision now rejected at registration with ArgumentException
  • String Formatting: Improved performance with reduced allocations
  • Function Overload Caching: Added caching for function overload lookups to improve performance

Fixed

  • Comparison Validation: Boolean vs String comparisons now properly rejected in both directions
    • Previously true == "hello" incorrectly succeeded without throwing exception
  • Function Overload Cache: Cache now properly invalidates when overloads are added dynamically
  • VariableValue String Conversion: Fixed asymmetric getter/setter behavior
    • StringValue getter now converts all types to string (previously returned null)
    • Float/Double/Decimal setters now support String-typed variables (previously threw exception)
    • All setters use InvariantCulture for culture-safe round-trip conversion
  • Assignment Operators Divide/Modulo by Zero: /= and %= now throw DivideByZeroException for all numeric types
    • Previously only integer types threw; float/double/decimal returned Infinity or NaN
    • Now consistent with regular / and % operators

v2.0.0

31 Oct 12:54

Choose a tag to compare

Added

  • Contextual Custom Functions: Functions can read variables from execution environment without explicit parameters
    • CustomFunction.CreateContextual() factory methods for context-aware functions
    • Supports up to 3 context variables and 3 script parameters

Changed

  • BREAKING CHANGE: CustomFunction.Create() parameter renamed from isConstant to isDeterministic
    • CustomFunction.IsConstant property renamed to IsDeterministic
  • BREAKING CHANGE: CompiledScript.IsConstant property renamed to IsPrecomputable
  • BREAKING CHANGE - Parser Validation: Syntax errors now detected earlier during compilation
    • Adjacent values without operators (e.g., 1 2, x y)
    • Trailing and leading operators (e.g., 1 +, + 1)
    • Mismatched parentheses (e.g., (1)
    • Empty grouping parentheses () (function calls func() remain valid)
    • Invalid assignment targets (e.g., 1 = 2)
    • Impact: Invalid assignments (e.g., 1 = 2) now throw ParserException during compilation instead of RuntimeException during execution
  • BREAKING CHANGE: VariableValue.IntegerValue/LongValue now throws InvalidCastException for NaN or Infinity
    • Previously returned 0
  • BREAKING CHANGE: Boolean VariableValue can now be read as float/double/decimal types
    • true converts to 1.0, false converts to 0.0 (matching integer conversion behavior)
  • Error Messages: Improved error message clarity
  • Function Resolution Caching: Function overload lookups cached per execution for improved performance
  • Multiply-Add Optimization: Improved performance for expressions matching patterns (a*b)±c and c±(a*b)

Fixed

  • Type Enum Serialization Compatibility: Restored pre-1.3.0 enum indices for Integer/Float/Boolean/String
    • Version 1.3.0 broke serialization by reordering existing types

v1.3.0

07 Oct 13:03
41c9e77

Choose a tag to compare

Added

  • Configurable Numeric Precision: New Compiler(IntegerPrecision, FloatPrecision) constructor
    • Integer: Integer (32-bit, default) or Long (64-bit)
    • Float: Float (32-bit, default), Double (64-bit), or Decimal (128-bit)
  • CompiledScript API Expansion: New properties for accessing values at different precisions
    • Added LongValue, DoubleValue, DecimalValue properties
    • Added IntegerPrecision and FloatPrecision properties to query compiler configuration
  • VariableValue API Expansion: Support for all numeric precision types
    • New constructors: VariableValue(long), VariableValue(double), VariableValue(decimal)
    • New properties: LongValue, DoubleValue, DecimalValue with automatic type conversion
  • Precision-Aware Operations: Variables and expressions automatically adapt to compiler precision
    • Variables auto-convert to match compiler precision during evaluation
    • Assignment operators correctly handle cross-precision conversions
    • Original variable types preserved; conversion happens only during expression evaluation

Changed

  • Performance Improvements: Float precision operations optimized
    • Built-in float functions now use MathF instead of casting System.Math
    • Aggressive inlining on hot-path value property accessors
    • Switch expressions used for type dispatch, reducing branching overhead

v1.2.1

02 Oct 00:44

Choose a tag to compare

This is a maintenance purpose release for Unity package. No change to a program has been made.

v1.2.0

01 Oct 12:45

Choose a tag to compare

Added

  • Period characters in identifiers: Variable names and function names can now contain periods (e.g., user.name, math.square())
  • VariableId struct: Strongly-typed variable identifier that replaces direct uint usage
    • Provides implicit conversions to/from uint and string for backwards compatibility
    • Maintains internal unique identifier mapping through extension methods
    • Improves type safety and encapsulates identifier management
  • Boolean Short-Circuit Optimization: Compile-time optimization for boolean expressions
  • String variable support with integer parsing
  • Support for CustomFunction.Create with zero-parameter functions that have return values (Func<TResult>)
  • AddCustomFunctionRange(IEnumerable<CustomFunction> functions) method for adding multiple custom functions at once
  • Documentation clarification on function purity requirements

Fixed

  • Unity Compatibility: Added conditional compilation support for Unity's UnsafeUtility.As API in TypeTraits.cs
  • AST Optimization: Fixed Compiler.cs optimization pipeline where rootNode.Optimize() result was being discarded instead of captured, causing some AST optimizations to be ignored
  • Constant Function Folding: FunctionNode.Optimize() now evaluates constant functions with constant parameters at compile time
  • Sign Operator Optimization: Fixed unary positive operator (+expr) returning unoptimized child node instead of optimized result
  • Trailing Semicolon Support: Trailing semicolons are now allowed and treated as no-op instead of throwing "Cannot find tokens to sequence" error

Changed

  • BREAKING CHANGE: IVariableContainer.TryGetValue() now takes VariableId instead of uint
    • Existing implementations must be updated to use VariableId parameter
    • Most calling code continues to work due to implicit uintVariableId conversion
  • AST Node Build() method signatures updated to use IDictionary<VariableId, CustomFunctionOverload>
  • Internal function dictionaries now use VariableId keys instead of uint
  • Comparison operators <= and >= now use direct operations instead of < || == and > || ==
  • Eliminated direct calls to GetUniqueIdentifier() and GetStringFromUniqueIdentifier() in favor of VariableId implicit conversions

Migration Guide

For custom IVariableContainer implementations:

// Before
public bool TryGetValue(uint variableKey, out VariableValue variableValue)

// After
public bool TryGetValue(VariableId variableKey, out VariableValue variableValue)

Most existing code using uint variable identifiers will continue to work due to implicit conversions.

v1.1.0

28 Sep 11:26
195b58d

Choose a tag to compare

Added

  • Division by zero checks for integer and float operations
  • Float-to-int conversion overflow handling (NaN, infinity, out-of-range values)
  • Unit testing infrastructure and test coverage

Changed

  • BREAKING CHANGE: CustomFunction API redesigned from fixed signatures to flexible factory pattern
    • Old: Limited to predefined function signatures (IntInt, FloatFloat, etc.) with union-based storage
    • New: CustomFunction.Create("name", delegate) supporting any delegate type with 1-5 parameters
    • Removes the need to match specific signature enums, allowing natural delegate usage
  • FloatNode boolean conversion now handles NaN and infinity cases
  • Math.IsNearlyEqual sign comparison logic fixed (aInt < 0 != bInt < 0)
  • Optimized unique identifier utility

Fixed

  • ArithmeticNode now throws DivideByZeroException for division/modulo by zero
  • ArithmeticNode provides specific error messages for boolean arithmetic operations
  • ArithmeticNode provides specific error messages for unsupported string operations

v1.0.0

26 Sep 13:28

Choose a tag to compare

Remove unary positive operator on AST optimization