Releases: aki-null/epsilon-script
Releases · aki-null/epsilon-script
v2.1.0
Added
- NoAlloc Compiler Option: Blocks runtime heap allocations
Compiler.Options.NoAllocflag throwsRuntimeExceptionfor string concatenation andToString()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 signaturefunc(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+ parametersfunc(2.0, x)fails when no overload accepts float at position 0
- Constant expressions fully validated:
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"
- Error messages include both line and column:
- 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
- Previously
- 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
- StringValue getter now converts all types to string (previously returned
- Assignment Operators Divide/Modulo by Zero:
/=and%=now throwDivideByZeroExceptionfor all numeric types- Previously only integer types threw; float/double/decimal returned Infinity or NaN
- Now consistent with regular
/and%operators
v2.0.0
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 fromisConstanttoisDeterministicCustomFunction.IsConstantproperty renamed toIsDeterministic
- BREAKING CHANGE:
CompiledScript.IsConstantproperty renamed toIsPrecomputable - 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 callsfunc()remain valid) - Invalid assignment targets (e.g.,
1 = 2) - Impact: Invalid assignments (e.g.,
1 = 2) now throwParserExceptionduring compilation instead ofRuntimeExceptionduring execution
- Adjacent values without operators (e.g.,
- BREAKING CHANGE:
VariableValue.IntegerValue/LongValuenow throwsInvalidCastExceptionfor NaN or Infinity- Previously returned
0
- Previously returned
- BREAKING CHANGE: Boolean
VariableValuecan now be read as float/double/decimal typestrueconverts to1.0,falseconverts to0.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)±candc±(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
Added
- Configurable Numeric Precision: New
Compiler(IntegerPrecision, FloatPrecision)constructor- Integer:
Integer(32-bit, default) orLong(64-bit) - Float:
Float(32-bit, default),Double(64-bit), orDecimal(128-bit)
- Integer:
- CompiledScript API Expansion: New properties for accessing values at different precisions
- Added
LongValue,DoubleValue,DecimalValueproperties - Added
IntegerPrecisionandFloatPrecisionproperties to query compiler configuration
- Added
- VariableValue API Expansion: Support for all numeric precision types
- New constructors:
VariableValue(long),VariableValue(double),VariableValue(decimal) - New properties:
LongValue,DoubleValue,DecimalValuewith automatic type conversion
- New constructors:
- 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
MathFinstead of castingSystem.Math - Aggressive inlining on hot-path value property accessors
- Switch expressions used for type dispatch, reducing branching overhead
- Built-in float functions now use
v1.2.1
v1.2.0
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
uintusage- Provides implicit conversions to/from
uintandstringfor backwards compatibility - Maintains internal unique identifier mapping through extension methods
- Improves type safety and encapsulates identifier management
- Provides implicit conversions to/from
- Boolean Short-Circuit Optimization: Compile-time optimization for boolean expressions
- String variable support with integer parsing
- Support for
CustomFunction.Createwith 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.AsAPI inTypeTraits.cs - AST Optimization: Fixed
Compiler.csoptimization pipeline whererootNode.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 takesVariableIdinstead ofuint- Existing implementations must be updated to use
VariableIdparameter - Most calling code continues to work due to implicit
uint→VariableIdconversion
- Existing implementations must be updated to use
- AST Node
Build()method signatures updated to useIDictionary<VariableId, CustomFunctionOverload> - Internal function dictionaries now use
VariableIdkeys instead ofuint - Comparison operators
<=and>=now use direct operations instead of< || ==and> || == - Eliminated direct calls to
GetUniqueIdentifier()andGetStringFromUniqueIdentifier()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
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