Repository navigation
ASFv2.0.0
Summary
ASF v2.0.0 is a significant improvement over the previous version. This version adds support for classes, object literal methods, debug tracing, and extends the coverage of the test suite. Also the documentation is now more complete.
Highlights
-
Added
letkeyword support- Bitwise or (
|) operator undefineddata type- Support for classes:
class Shape { field x = 0, y = 0, color = 'black'; constructor(x, y) { this.x = x; this.y = y; }; getPosition() { return this.x + ',' + this.y; }; }; class Circle extends Shape { field radius = 1; constructor(x, y, r) { super(x, y); this.radius = r; this.color = 'red'; }; getArea() { return 3.14159 * this.radius * this.radius; }; }; let circle = new Circle(10, 20, 5); print('Position: ' + circle.getPosition()); // => 'Position: 10,20' print('Color: ' + circle.color); // => 'Color: red' print('Area: ' + circle.getArea()); // => 'Area: 78.53975'
- Objects methods:
o = {apple: 10, banana: 20, cherry: 30}; result = o.filter(fun(val, key) { return key.startsWith('a') }); return result; // => { apple: 10 }
- The
ASF.ReadTextFilemethod allows users to get source code from text files. - Language reference documentation.
-
Internal core change:
- VM:
-
Improved
stepinfornode: now supports compound assignments -
Users can now inspect the call stack through debug tracing.
Dim ASF_ As New ASF Dim code As String ' Enable call tracing ASF_.EnableCallTrace = True code = "fun add(a, b) { return a + b; };" & vbCrLf & _ "fun multiply(a, b) { return a * b; };" & vbCrLf & _ "x = add(3, 4);" & vbCrLf & _ "y = multiply(x, 3);" & vbCrLf & _ "print(y)" Dim idx As Long idx = ASF_.Compile(code) ASF_.Run idx ' Print the call stack trace Debug.Print "=== Call Stack Trace ===" Debug.Print ASF_.GetCallStackTrace() ' Clear for next run ASF_.ClearCallStack
The above code will print
=== Call Stack Trace === CALL: add(3, 4) -> 7 CALL: multiply(7, 3) -> 21
-
- VM:
-
Fixed:
- Compiler: fixed an error that prevented
Collectionvariables from initializing correctly, causing a fault at compilation phase. - Compiler: fixed nested try-catch parsing issue.
- Compiler: fixed
trystatement requiring a mandatorycatchblock. - Map container: fixed nested maps cloning bug.
- Parser: fixed compound assignment bug.
- VM: fixed use of non-existent property when accessing
ASF_ScopeStackkeys. - VM: fixed bug in
typeOfreturning numeric types when invoked withnullvalues. - VM: fixed switch statement executing all cases even when a match was found.
- Regex: fixed line of statements compiled as comment in VBA.
- Regex: fixed greedy sub quantifier.
- Compiler: fixed an error that prevented
Full Changelog: v1.0.7...v2.0.0