apollovm 0.1.43
apollovm: ^0.1.43 copied to clipboard
ApolloVM, a Multilingual portable VM (native, JS/Web, Flutter) for Dart, Java, Kotlin, C#, JavaScript, TypeScript, Lua and Python with on-the-fly Wasm compilation.
0.1.43 #
Wasm backend: close several Dart → WebAssembly gaps #
- Unqualified sibling class-method calls now resolve: a method can call a
sibling
staticmethod by bare name (dbl(x)instead ofFoo.dbl(x)), including with named arguments and omitted default parameters. String + <number>concatenation (from Java/Kotlin/C#/JS/TS, e.g."n=" + n) compiles, coercing the numeric operand to a String.switchon aStringscrutinee (content equality) andswitchon anenumscrutinee (compared by ordinal).switchonintalready worked. Also fixes a general function-end edge case: a control construct (switch/if/while) that returns on all paths as the last statement (e.g. after avardeclaration) compiled to a function that fell off its end without a return value.- Rich-enum methods that take an enum-typed parameter (
double ratio(Planet p)) compile; C#/TypeScript explicit-value enums expose.value. - Typed catch-all clauses (
on Exception catch (e)/catch (Exception e)) compile instead of failing on the declared exception type. - Known remaining gaps (documented, with skipped reproduction tests):
Map/List→ String coercion, generic (Box<T>) primitive fields, lambdas, andswitchon a boxeddynamic/Objectscrutinee.
0.1.42 #
Named / keyword arguments #
- Function, method and constructor calls can now pass arguments by name,
bound to parameters by name rather than position (so call-site order is free):
Dart
foo(a: 1, b: 2), Kotlinfoo(a = 1), C#foo(a: 1), Pythonfoo(a=1). - Dart also parses explicit named-parameter declarations (
int f({int a, int b})), optional-positional groups ([int b]), and the same forms in constructors (Box({this.w, this.h})); the other languages declare parameters positionally and allow any of them to be passed by name, matching each language's semantics. - Runtime, parsing and code generation all round-trip: a call's named arguments
regenerate in each language's syntax (
a: v/a = v/a=v) and re-parse to the same result. Languages without a native named-argument concept (Java, JavaScript, TypeScript, Lua) are unaffected and keep positional calls. - Wasm: the on-the-fly WebAssembly compiler accepts named-argument calls, reordering them into the callee's positional parameter slots.
Default values for optional and named parameters #
- Optional and named parameters can declare a default value that is used
when the argument is omitted: Dart
int f({int a = 5})/[int b = 3], Kotlinfun f(a: Int = 5), C#void F(int a = 5), Pythondef f(a=5)(including default-bearing constructor parameters, e.g.Box({this.w = 2})). Defaults are evaluated at call time, round-trip through code generation, and are overridden by any supplied positional or named argument. The Wasm compiler also fills omitted parameters with their (constant) default expressions.
CLI: compile command (WebAssembly) #
- New
apollovm compile [-o out.wasm] [--target wasm] <source>command compiles a source file to a WebAssembly binary via the on-the-fly Wasm compiler, writing one.wasmfile per generated module (alongsiderunandtranslate).
Tests reorganized by concern #
- The
test/suite is grouped intounit/,features/,languages/,wasm/,integration/andmeta/subdirectories (no behavior change).
0.1.41 #
Rich enums (enum entries are const class instances) #
- Enums are redesigned: an enum is a class and each entry is a cached
constinstance — a singleton, so==is identity — replacing the int-ordinal model. Every entry carriesindex(ordinal) andname, andEnumName.valueslists them. Dart enhanced enums work: entries with constructor arguments, fields, and methods (Planet.earth.gravity()). Explicit-value entries (C#/TypeScriptMedium = 5) expose the value via.value. - Parsing: Dart, Java and Kotlin parse rich-enum entry args + members.
- Generation: Java/Kotlin emit native rich enums; C#/TypeScript/Python emit a
class +
static-const-instances idiom (simple enums are unchanged). - Wasm: enum entries compile to heap instances (lazily built, cached per entry);
.index/.name/fields/methods andEnumName.valuesall work. - Breaking change: an enum entry is no longer an
int— useColor.blue.index(and.valuefor explicit= Nentries) instead ofint x = Color.blue.
Constructors & instantiation for JavaScript and Python #
- JavaScript: a
constructor(...)class method is now parsed as a real constructor, andnew Foo(...)/Foo(...)instantiate the class (running the constructor, which can assignthis.x = …). Round-trips toconstructor(...)and translates to other languages. - Python:
self.x = …attribute assignment is now parsed,__init__is treated as the constructor, andFoo(...)instantiates the class. The generator emitsdef __init__(self, …). (Previously instance-field assignment was unimplemented, so__init__wasn't usable end-to-end.) - Both round-trip across languages (e.g. a JS/Python class with a constructor translates to a runnable Dart class). The README OOP table marks JS and Python "Constructors & instantiation" as supported.
async/await for JavaScript, TypeScript, C# and Python #
- These languages now parse
asyncfunctions/methods (andasyncarrows / lambdas) and theawaitexpression, joining Dart. Parsed code executes on the shared async runtime, round-trips back to its source language, and translates across languages (e.g. C#async Task<int>⇄ DartFuture<int> … async). - C# and Python also gained
asynccode generation (async/async def); the JavaScript and TypeScript generators already emitted it. awaitnow unwraps any awaitable type —Future<T>,Promise<T>(TypeScript) andTask<T>(C#) — to its value typeT, so awaiting a typed result infers the correct type. A shared word-boundary keyword token keeps identifiers likeawaiterfrom being read asawait+er.- The README "Control flow & operators" table gains an
async/awaitrow.
Wasm: static methods + boxed Object #
- The WebAssembly compiler now supports
staticclass methods: each is synthesized as an exported module function under the qualifiedClass.methodname (nothis), generated like a top-level function.ApolloRunnerWasmgainsexecuteClassMethod, resolving the export by that name. - New boxed representation for
Object/dynamicvalues: an i32 pointer to a 16-byte heap cell[tag@0][typeId@4][payload@8]. Concrete values flowing into anObjectslot are boxed, andtoString()dispatches on the box tag (int/double/bool/String, plus boxed instances bytypeId). EnablesList<Object>/List<dynamic>literals and arguments with mixed element types, marshalled host-side byApolloRunnerWasm. - A homogeneous list literal initializing a
List<Object>/List<dynamic>variable (e.g.List<Object> x = [1, 2, 3]) now boxes its elements. The literal infers a concrete element type (List<int>) and previously stored unboxed values that the boxed read path misread (garbage output or an out-of-bounds trap); the declared target element type is now honored. - Validated against both the AST interpreter and the compiled+executed Wasm module.
Only static methods are callable without an instance #
- A non-static class method now requires a class instance to run. The
interpreter's
executeClassMethod(and any internal call that reaches a non-static method with nothisin context, e.g. astaticmethod calling an instance sibling) throwsApolloVMRuntimeErrorinstead of silently running against an auto-created instance. PassclassInstanceObject/classInstanceFieldsto run a non-static method, or mark the entry methodstatic. This matches the Wasm backend, where only static methods are exported. ApolloRunnerWasm.executeClassMethodnow reports a clear error for a non-static target (only static methods are exported) and rejects being given a class instance (the Wasm backend has no instance-method entry points).- The Wasm generator rejects a receiver-less call to a non-static method (e.g. a
staticmethod calling an instance sibling) with a clearUnsupportedError. - Examples and the README run entry methods as
staticwhere they hold no instance state, or supply an instance otherwise.
Tests #
- Test files now carry
dart testtags: a backend tag (wasm, pluswasm-gc/wasm-chromefor browser-only Wasm tests) and per-source-language tags (dart,java,kotlin,javascript,typescript,lua,csharp,python). E.g.dart test -t wasm,dart test -t kotlin, ordart test -x wasm-gcfor the nativewasm_runCI.
0.1.40 #
Wasm: control flow + bitwise #
- The WebAssembly compiler now supports
do/while,switch/case(integer, C-style fall-through),break,continue, and the bitwise operators& | ^ << >>and unary~. Loops now wrap their body in acontinueblock andWasmContexttracks structured-control depth sobreak/continueemit correct relative branch labels. Each construct is validated against both the AST interpreter and the compiled+executed Wasm module.
Bitwise operators: Kotlin and Lua #
- Kotlin: infix
and/or/xor/shl/shrandx.inv()(bitwise NOT). - Lua:
&/|/~(xor)/<</>>and unary~, leaving~=(not-equals) and^(exponent) intact.
Kotlin member visibility #
- Parse and generate member modifiers (
private/public/internal/protected, plusopen/override/abstract/final/const) on Kotlin methods/fields/constructors; method visibility round-trips.
Fixes #
- Java:
privatemembers no longer fail with "Can't be private and public" (the modifiers parser derivedisPublicfromprivate).
Docs #
- New "Supported Features" section in the README: per-language control-flow / operator matrix (with a Wasm column) and a Classes/types/OOP matrix.
0.1.39 #
enum runtime value access #
EnumType.entrynow resolves at runtime to the entry's value: its explicit value when present (C#Level.Medium→5), otherwise its ordinal index (DartColor.blue→2).ASTRoot.getNodeIdentifierresolves user classes/enums by name; enum entry access short-circuits inASTExpressionObjectGetterAccess.
Generics #
- Parse generic type annotations in Java and C# (
List<Integer>,Map<String,Integer> m,Box<T>); well-known collections map to the shared array/map types, other generic types keep their type arguments and round-trip. - Support generic class declarations and instantiation across the languages that
have generics:
class Wrapper<T> { T value; … }plusnew Wrapper<int>(10)/Wrapper<int>(10). Class type parameters are erased todynamicin member types; generic type arguments on calls are parsed. Runs end-to-end in Dart, Java, C#, Kotlin and TypeScript. - Type system: generic erasure in
ASTType.acceptsType— a raw type and a parameterized one of the same name are mutually compatible (so aWrapperinstance binds to aWrapper<int>variable).
Fixes #
- Java for-each now generates the colon form
for (Type x : coll)instead of the invalidfor (var x in coll), so generated Java re-parses. - Kotlin
val/varkeywords now require a word boundary, so identifiers likevalueare no longer mangled (e.g. a constructor parametervaluewas read asue). - Kotlin and TypeScript class instantiation/constructors now execute: a
constructor with an omitted class name (
constructor(...)) resolves its type from the enclosing class, and TypeScriptconstructor(...)is parsed as a real constructor sonew Foo(...)works.
0.1.38 #
Language: C# — lambda parsing #
- Parse C# lambda expressions (
x => x * 2,(a, b) => a + b,(int a) => { ... },() => 0); previously C# could only generate lambda syntax, not read it. - Delegate type names (
Func,Action,Delegate,Function) map to the shared function type, so a lambda value binds to a delegate-typed parameter.
Control flow: switch/case, break, continue, do/while #
- New shared AST/runtime nodes (
ASTStatementBreak,ASTStatementContinue,ASTStatementDoWhileLoop,ASTStatementSwitch/ASTSwitchCase).break/continuepropagate throughASTBlockand are consumed by the enclosing loop/switch;forstill runs its increment oncontinue. switchuses C-style fall-through (breakends a case;defaultruns when no case matches). AnASTStatementSwitch.fallThroughflag disables fall-through for languages whose construct has none.- Parsing + code generation added to the C-style languages: Dart, Java, C#,
JavaScript, TypeScript (each
casebody accepts a braced block or a bare run of statements). - Mapped to each non-C-style language's idiom:
- Kotlin:
break/continue,do { } while (c), andwhen (e) { v -> …; else -> … }(no fall-through). - Python:
break/continue, andmatch/case(case _:is the default; no fall-through). Python has nodo/while. - Lua:
break, andrepeat … until <cond>mapped to a do-while (the condition is negated; the generator unwraps it to emituntil <cond>).
- Kotlin:
- New golden tests under
test/tests_definitions/*_control_flow*.test.xmlfor all eight languages.
Bitwise operators #
- New operators
&,|,^,<<,>>(binary) and~(unary complement), with shared AST/runtime evaluation (intoperands) and precedence (shift, then AND/XOR/OR, between arithmetic and comparison). - Parsed and generated in Dart, Java, C#, JavaScript, TypeScript, Python.
Java additionally gains the previously-missing
%,&&and||operators. - Not added for Kotlin (bitwise are infix functions
and/or/shl/inv) or Lua (~is xor and^is exponentiation) — their non-symbolic forms need bespoke handling. - New golden tests
test/tests_definitions/*_bitwise.test.xml.
enum (Java, C#, Kotlin, Python) #
- Enum declaration parsing + generation extended to Java (
enum E { … }), C# (enum E { A = 1, … }), Kotlin (enum class E { … }) and Python (class E(Enum): …), joining the existing Dart/TypeScript support. - Declaration + round-trip only (matching the prior Dart/TS level); runtime enum-value access is a separate future enhancement.
- New golden tests
test/tests_definitions/*_enum.test.xml.
0.1.37 #
Language: C# #
- New self-contained C# language support (
csharp, also acceptingcsandc#) able to parse, run and translate, at the same level of compatibility as Dart and Java: classes, fields (incl. initial values), constructors, methods and modifiers (public/private/static/readonly/…),usingdirectives, variable declarations (varand typed), the full expression set (arithmetic/comparison/logical operators, ternary?:,++/--, negation), string concatenation,if/else if/else,for,foreach (T x in coll),while,try/catch/finally,throw, lambdas (=>), andList<T>/Dictionary<K,V>collection initializers. - C# types map to the shared AST (
int/long/short→ int,double/float/decimal→ double,bool,string,object, …) so code translates cleanly to/from every other supported language. - Registered in
ApolloVM(getParser,createRunner,createCodeGenerator) and exported fromapollovm.dart;.csfiles resolve to thecsharplanguage. - New golden tests under
test/tests_definitions/csharp_*.test.xml.
Lambda / anonymous-function input parsing (Java, Kotlin, Lua) #
- Java: parse lambdas as expressions —
(a, b) -> expr,(int a) -> { ... },x -> x * 2,() -> 0(typed or untyped parameters). - Kotlin: parse lambdas
{ x -> x * 2 },{ x: Int, y: Int -> x + y },{ 42 }; the last expression is the implicit return value. - Lua: parse anonymous functions
function(x) ... end. - Closures now round-trip (parse → execute → regenerate) in these languages, not just generate.
Wasm: host imports no longer corrupt module-function call indices #
- A module-function
callindex isimportCount + position, but host imports (env.print,env.int_to_str, …) are registered lazily while bodies are generated. A call emitted before an import was registered (e.g. calling a function and thenprint-ing, including acrossawaitpoints) got a stale index and produced invalid Wasm (type mismatch). The import-discovery pass that freezesimportCountbefore the real pass now runs for all modules (it only touches idempotent state, so import-free modules stay byte-identical). - Fixes
async/awaitfunctions that call other functions andprintbetween awaits, which now run identically on the interpreter and Wasm.
Wasm: closures capture variables by reference #
- Captured variables are now "boxed" into shared heap cells: the closure environment holds pointers to the cells (not copied values), so a variable mutated after a closure is created — or mutated by the closure — is visible on both sides, matching the interpreter. Each closure instance still gets its own cell (e.g. two counters created from the same factory are independent).
0.1.36 #
Ternary / conditional expressions #
- Parse
condition ? a : bin Dart, Java, JavaScript and TypeScript, plus the native conditional-expression formsa if condition else b(Python) andif (condition) a else b(Kotlin). - New
ASTExpressionConditionalAST node (only the selected branch is evaluated); generated idiomatically per target:?:(Dart/Java/JS/TS),a if c else b(Python),if (c) a else b(Kotlin),c and a or b(Lua), and a value-typedif/elseblock in Wasm.
Anonymous functions / lambdas / closures #
- New
ASTExpressionLiteralFunctionAST node that captures the defining scope (closure semantics); function values held in variables/parameters are now invocable. - Parse anonymous functions:
(x) => …/(x) { … }(Dart),(x) => …/x => …(JavaScript, TypeScript) andlambda x: …(Python). - Generate anonymous functions for every target: arrow forms (Dart/JS/TS),
Java
(x) -> …, Kotlin{ x -> … }, Luafunction(x) … end, Pythonlambda x: ….
Dart function types #
- Parse function types
int Function(int n),void Function()andFunction(int n)(omitted return type →dynamic);ASTTypeFunctionaccepts any other function type, and function types are generated asint Function(int)(Dart) / bareFunctionelsewhere.
Wasm: closures via function table + call_indirect #
- Added Table and Element sections and the
call_indirectinstruction. A function value is an i32 pointer to a heap environment struct[tableSlot, captured…]; each closure function takes a hidden environment pointer and reads its captured variables from it. - Concrete signatures are inferred for capture-less closures, untyped lambda
parameters, capturing closures, and closures returned through a concrete
Functionreturn type. Each closure instance gets its own heap environment. - Not yet supported in Wasm: polymorphic dynamic-return function types (a
Function(int)parameter called with both anint- and adouble-returning lambda) — these report a clear error and still work on the interpreter.
Bug fixes #
- Python:
self.method()andself.fieldnow round-trip correctly; fixed aself.fieldgetter parse crash and a stack overflow on self-referential bindings (s = s + i) during code generation. - Local function declarations were duplicated in regenerated code after a
function was executed (
addFunctionis now idempotent and block generation no longer emits a statement-level function twice). - Fixed doubled indentation of nested function declarations.
Documentation #
- Added Python to the package description and the README (a
Pythonlanguage section and updated the TODO list).
0.1.35 #
Python language support #
- Added Python language support (parse, run, and code-generation target),
emitting strict, idiomatic Python 3.
- Indentation-significant blocks are handled by an INDENT/DEDENT/NEWLINE
pre-tokenizer (
PythonIndentationPreprocessor), so the petitparser grammar consumes Python suites like braces; implicit ((/[/{) and explicit (\) line continuations, blank/comment lines, and string literals are handled, and the source is dedented by its common minimum indentation (so a uniformly-indented embedded block parses like a flush-left one). - Strict generation: PEP-484 type hints when the AST type is statically known
(
def f(x: int) -> int:,x: str = ...,List[T]/Dict[K, V]), with a dynamic/untyped fallback;==/!=,and/or/not,//integer division,True/False/None, f-strings for interpolation, andself-based methods. - Supports functions, variables (Python first-binding-is-declaration scoping),
arithmetic/comparison/boolean expressions,
if/elif/else,while,for ... in,try/except/finally+raise,classwith methods, lists & dicts, andimport/from ... import. - Registered
python(py/.py) acrossgetParser,createRunner,createCodeGenerator, and the CLI.
- Indentation-significant blocks are handled by an INDENT/DEDENT/NEWLINE
pre-tokenizer (
Wasm: print accepts any value (not only String) #
int/doublereuse the host number-to-string imports (env.int_to_str/env.double_to_str);boollowers in-module to the interned"true"/"false"literals (viaselect);print(null)prints"null". String interpolation gained the same parity.- The interpreter's mapped
printnow acceptsnull(nullableObject?), and aboolargument passed to a public Wasm function is marshalled to its i32 ABI value.
Classes and instantiation (Dart, Java, and Wasm) #
- The
newkeyword is now parsed in Dart and Java (new User());new User()andUser()resolve to the same constructor (boundary-safe, so identifiers likenewValueare unaffected). Java also gained a genericnew ClassName(args)rule (previously onlynew ArrayList<…>()/new HashMap<…>()were recognized). - Classes that declare no constructor get an implicit default (zero-arg) constructor — on the interpreter and the Wasm backend; field initializers still apply.
- Constructors that set fields:
this.fieldparameters, and constructor bodies that assign fields (this.field = valueand barefield = value, with parameters shadowing same-named fields, e.g.User(int id) { this.id = id; }). Fixed empty-parameter constructors with a body (User() { … }), which threw a parser cast error. - A class method can instantiate sibling classes and call top-level functions
(
ASTClass.getFunctionfalls back to the enclosingASTRoot) — essential for Java, where all code lives in a class. - Dart arrow (expression-bodied) functions and methods:
T name(params) => expr;(e.g.String toString() => '…';), for top-level functions and instance methods, includingvoidbodies. Desugars to{ return expr; }. - WebAssembly compilation of classes (first slice): single classes (no
inheritance) with
int/double/bool/String/ object-reference fields, constructors (this.fieldparams, field initializers, default and body constructors), instance methods, in-code instantiation, and method calls (p.sum()and implicit-thisfoo()). An object is an i32 pointer to a bump-allocated struct; methods takethisas the first parameter; a discovery pass registers host imports before the code section so cross-function call indices stay correct.
Object field access on instances (read and write) #
- Field assignment
obj.field = value(andthis.field = value), including compound operators (+=,-=,*=,/=,~/=), via a newASTExpressionObjectSetterAssignmentnode — added to the Dart, Java, Kotlin, JavaScript and TypeScript grammars, the shared source generator (round-trips back toobj.field = value), and the Wasm backend (stores atrecv + offset). - Field read
obj.fieldis now supported in Java (which had no object getter-access rule);this.fieldreads resolve to the current instance's field across all languages (previously routed to a local-getter lookup and failed with "Can't find getter").
print(obj) calls the user-defined toString() #
- Interpreter:
print(instance)invokes a user-declaredtoString()(a class without one still prints the defaultClass{…}representation), andASTExternalFunction.callnow awaits resolved argument values so an async resolver result isn't passed through as aFuture. - Wasm:
print(instance)(and string coercion / interpolation) calls the instance's compiledtoString()and prints the resulting string handle.
This makes programs like the following compile and run on Wasm with interpreter-parity:
class User {
int id;
String name;
User(this.id, this.name);
String toString() => 'User#$id<$name>';
}
void main() {
var user = new User(123, 'Joe');
print(user);
print(user.id * 1000);
}
Not included: inheritance / interfaces / abstract / static members /
polymorphism.
0.1.34 #
- Wasm
throw/try/catch/finally: exception handling now compiles to WebAssembly (previously deferred / loud-failure), engine-agnostic — no Wasm exception-handling proposal required.- A function that uses (or transitively calls) exceptions is lowered to a
$pc-dispatched CFG (like the Asyncify transform but without suspension), so athrowis an absolute jump to the nearest handler — no fragile relativebrbookkeeping. The thrown value + an in-flight flag live in a small fixed exception region of linear memory. - Supported:
throwof int/double/bool/String/object values; typed (on T catch), untyped, and multiple catch clauses; type matching that mirrors the interpreter (ASTType.acceptsType, e.g.on doubleaccepts anint);finallyon every exit path (normal, caught, propagated, andreturn-through-finally, withreturn-in-finallyoverriding);throwinsideif/while/for; cross-function propagation (a callee sets the pending flag + returns, each call site re-checks it); and catching VM traps — integer division by zero (1 ~/ 0) raises a catchableStringinstead of trapping the module. - Deferred (these fail loudly rather than miscompile):
async/awaitcombined with exceptions in the same function,for-eachcontaining athrow, multiple raising operations in a single statement, andreturn <throwing call>directly inside atry.
- A function that uses (or transitively calls) exceptions is lowered to a
0.1.33 #
- Exception handling:
throw,try/catch/finallyfor Dart, Java, Kotlin, JavaScript and TypeScript (parse, run and translate).- New AST nodes
ASTStatementThrow,ASTStatementTryCatchandASTCatchClause; a thrown value is carried by the newApolloVMThrownException. - Catch semantics (faithful to Dart's
catch (e)): an untypedcatchcatches both userthrown values and built-in VM runtime errors (e.g. integer division by zero, surfaced as their messageString); a typed clause matches user-thrown values by type. The universal supertypes (Object,dynamic,Exception,Throwable,Error) act as catch-all so an untyped catch round-trips faithfully across languages. finallyalways runs (on normal completion, after a caught throw, or on areturninsidetry/catch), and areturninsidefinallyoverrides.- Per-language catch syntax on both parse and generation: Dart
on T catch (e)/catch (e), Javacatch (T e)(untyped →catch (Exception e)), Kotlincatch (e: T)(untyped →catch (e: Throwable)), JS/TScatch (e). - Wasm
try/catch/throwis deferred: it fails loudly (no silent miscompile).
- New AST nodes
0.1.32 #
- Wasm Asyncify: awaits inside
for-eachover a list.for (T e in it)is desugared in the CFG into an indexed loop (__i = 0; while (__i < it.length) { T e = it[__i]; body; __i++ }), so awaits in the body really suspend.it[__i]uses the normal list index-access; the index/length are temp locals spilled/restored on the Asyncify frame stack, and the only non-AST bit (the length read + index reset) is emitted via a small per-block raw hook. The iterable must be a list variable; other iterables fall back to synchronous-collapse. Tested end-to-end throughApolloRunnerWasm.
0.1.31 #
-
TypeScript language support (parse, run, translate):
- New language at
lib/src/languages/typescript/ts/:ApolloParserTypeScript,TypeScriptGrammarDefinition,TypeScriptGrammarLexer,ApolloCodeGeneratorTypeScript,ApolloRunnerTypeScript. - Superset of JavaScript: all JS features plus type annotations on
variables, parameters, return types and class fields
(
number/string/boolean/any/void,T[]/Array<T>), interfaces, enums, and access modifiers (public/private/protected/readonly/static/abstract). - Code generation emits idiomatic TypeScript (type annotations,
interface,enum,abstract class, member modifiers) and erases types cleanly when targeting JavaScript. - Registered
'typescript'/'ts'in the parser/runner/generator factories and the.tsfile-extension mapping; CLIapollovm run/translatesupport.ts. - Tests: TypeScript test definitions under
test/tests_definitions/plus thetest/hello_world.tsfixture andexample/apollovm_example_typescript.dart.
- New language at
-
Generalized class/member modeling in the shared AST (used by Dart and TypeScript):
ASTModifiers: addedisAbstractandisProtected(andmodifierAbstract).ASTClassNormal: addedkind(ASTClassKind.normalClass/abstractClass/interface), plus optionalsuperClassNameandimplementsTypes.- New
ASTClassEnum(extendsASTClassNormal) withASTEnumEntryentries. ASTClassField: added amodifiersfield (e.g.static/private/readonly).- Dart now parses and generates
abstract class,enum,extends/implements, abstract (body-less) methods, andstaticfields; these cross-translate between Dart, TypeScript and JavaScript.
0.1.30 #
-
Wasm Asyncify: awaits inside control flow (
if/if-else/else if,while,for), plusreturn await ...andx = await .... The generator lowers such async functions into a CFG of basic blocks and emits a program-counter state machine — aloop+br_tabledispatch over a$pclocal, with$pcspilled/restored on the Asyncify frame stack alongside the locals. Awaits become block boundaries; leaf (host) and internal (module- async) awaits both work inside loops/branches, composing with multi-frame unwinding. Functions whose awaits are all top-level keep the linear path. Awaits nested inside expressions (t = t + await f(),return await f() + 1,await f() + await g()) are hoisted into temp locals automatically. Remaining unsupported shapes (for-each, awaits in loop/branch conditions) fall back to synchronous-collapse. Tested end-to-end throughApolloRunnerWasm. -
async/awaitsupport (real asynchrony) — Dart parse/run/translate and JavaScript translation:- AST: new
ASTModifiers.isAsync, newASTExpressionAwaitexpression, and a new abstractgenerateASTExpressionAwaitgenerator hook. Reuses the existingASTTypeFuture/ASTValueFuture(addedASTTypeFuture.futureValueType). - Runtime: an
asyncfunction returns a first-class future immediately (a non-awaited call yields anASTValueFuturethat can be stored and awaited later);awaitsuspends on real DartFutures, including those returned by external functions declared with aFuture<...>return type.ASTEntryPointBlock.executeawaits the entry future before tearing down the entry-point context (external mapper, current context). - Dart grammar: parses the
asyncbody keyword (after the parameter list) and theawaitprefix expression;Future<T>types parse toASTTypeFuture; theawait/asynccontextual keywords no longer shadow identifiers (e.g.awaiter) or get read as a type name. - Code generation: Dart emits
... ) async {andawait; JavaScript emitsasync function/async name(andawait. - Wasm: async/await compiles via synchronous collapse — the backend runs
synchronously, so
Future<T>collapses toT(effectiveReturnType) andawaitis a value pass-through. Compute-style async Dart compiles to Wasm and matches the AST interpreter. - Wasm real-suspension Asyncify prototype
(
test/apollovm_wasm_asyncify_prototype_test.dart): a hand-assembled two-frame module proves real suspension against the liveWasmRuntime— a running call unwinds to the host (saving live locals to linear memory), the host awaits a real DartFuture, then re-invokes the export which rewinds and resumes. Demonstrates multi-frame state preservation, exactly-once prologue execution, and two concurrent computations interleaving by host delay. - Wasm Asyncify code generation: the generator emits the unwind/rewind
state machine for an
asyncfunction whoseawaits are statement-level calls — a low-memory Asyncify control region (WasmModuleContext) with a LIFO frame stack, live-local spill/restore,br_tableresume dispatch supporting multipleawaitpoints in one function, and multi-frame unwinding: anasyncfunction mayawaitanother moduleasyncfunction (an internal frame) as well as a host import (a leaf). The unwind propagates up every frame on the call stack to the host and rewinds back down (an eligibility fixed-point decides which async functions transform; the rest use synchronous-collapse). Validated against the live runtime intest/apollovm_wasm_asyncify_codegen_test.dartand the multi-frame / mixed-await cases intest/apollovm_wasm_asyncify_runner_test.dart. Shapes that still fall back to synchronous-collapse: awaits nested in control flow, multiple awaits in one statement, and async recursion. - Wasm Asyncify runner integration:
ApolloRunnerWasm.executeFunctionnow detects real-suspensionasyncfunctions (flagged inapollovm_sig) and drives their unwind/rewind loop, awaiting a real DartFuturefrom a host function registered via the newApolloRunnerWasm.mapWasmAsyncFunctionAPI. So real-suspension async/await works end-to-end through the VM (test/apollovm_wasm_asyncify_runner_test.dart). Abr_tablemulti-await/multi-frame transform is the remaining follow-up. - Kotlin async/await translation: an
asyncfunction maps to asuspend fun(the declaredFuture<T>collapses toT), andawait ebecomes juste(suspension is implicit when calling asuspendfunction in coroutines). - Tests:
test/apollovm_async_test.dart(parse, real-suspension ordering, await chains, top-level async, identifier guard, Dart/JS/Kotlin translation) andtest/apollovm_wasm_async_test.dart(AST-vs-compiled-Wasm parity).
- AST: new
0.1.29 #
- Lua language support (parse, run, and translate):
- New
lib/src/languages/lua/module:ApolloParserLua,LuaGrammarDefinition/LuaGrammarLexer,ApolloCodeGeneratorLuaandApolloRunnerLua, all built on the shared AST (no AST changes). - Grammar covers top-level and
localfunctions,local/global variables,if/elseif/else,while, numeric and genericfor ... in ipairs(...),return, expressions/operators (and/or/not,~=,..concatenation), table constructors (list and map), and a table-based class convention (Name = {},Name.__index = Name,function Name:method(...)) grouped into the shared class AST. Return types are inferred (voidvsdynamic). - Generator emits idiomatic Lua: keyword-delimited blocks with
end,localvariables,..string concatenation,and/or/not/~=, table literals, andself./self:prefixing inside methods. - Registered in
ApolloVM(getParser/createRunner/createCodeGenerator). - Tests in
test/apollovm_lua_test.dartcover parse+run, translate+re-execute to Dart/Lua/Kotlin, and bidirectional table-based classes.
- New
0.1.28 #
- Kotlin language support (parse, run, and translate), reaching parity with the
existing Java feature set:
- New
lib/src/languages/kotlin/module:ApolloParserKotlin,KotlinGrammarDefinition/KotlinGrammarLexer,ApolloCodeGeneratorKotlinandApolloRunnerKotlin, all built on the shared AST (no AST changes). - Grammar covers top-level and class
fundeclarations,val/vardeclarations (with type inference),Int/Double/Boolean/String/Unit/Any/List/Maptypes,if/else,for (x in ...),while, expressions/operators,listOf/mapOfliterals, and"$x"/"${expr}"string templates.printlnis normalized to the VM'sprint. - Registered in
ApolloVM(getParser/createRunner/createCodeGenerator);.ktfiles already mapped tokotlin. - Tests in
test/apollovm_kotlin_test.dartcover parse+run and Kotlin→Dart/Java/Kotlin translation round-trips.
- New
- JavaScript (modern ES) language support — fully bidirectional:
- Parser (
ApolloParserJavaScript,JavaScriptGrammarDefinition,JavaScriptGrammarLexer): parses.js/javascriptsource into the shared ApolloVM AST. Covers classes (fields + methods,static,constructor), top-levelfunctiondeclarations,let/const/var,for/for...of/while,if/else if/else, list literals,++/--, compound assignment, strict equality (===/!==), and single/double-quoted strings plus back-tick template literals with${ … }interpolation. Untyped sites map todynamic; method/function return types are inferred asvoid(no value-return) ordynamic. - Code generator (
ApolloCodeGeneratorJavaScript): emits idiomatic modern JS from any loaded AST (Dart, Java, or JS) —let/const, template literals for string interpolation,for...of, top-level functions, untyped params/fields,===/!==, andMath.trunc(a / b)for integer division. - Runner (
ApolloRunnerJavaScript): executes JS-parsed ASTs in the VM (subject to the VM's existing limitation that arithmetic requires concrete/inferable types — dynamic-typed arithmetic is unsupported, as for Dartdynamic). - Registered
javascript/jsinApolloVM.getParser,createRunner, andcreateCodeGenerator. - CLI:
apollovm run/translatenow work on.jsfiles (the.jsextension already mapped tojavascript); added atest/hello_world.jsfixture and updated the CLI banner to "Dart, Java and JavaScript". - Tests: added
javascript_basic_*definitions (parse + execute + round-trip + cross-translation to Dart/Java) and a JavaScript generation block to the Dart class-function test. - Follow-ups: destructuring, spread, async/await, true
constructorsemantics withthis.xparameters, and full ESM are not yet supported.
- Parser (
- CLI bug fix:
apollovm translateprintedInstance of 'Future<StringBuffer>'instead of the translated source —writeAllSources()was stringified withoutawait. Fixed for all languages. - Runtime fix —
for-each/for...ofover any iterable:ASTStatementForEachonly accepted anASTValueArray, so iterating a list bound to adynamic/Objectvariable (which resolves to a plainASTValueStatic) threw at runtime. It now iterates any resolvedIterable(andMapvalues), and wraps each element into a concretely-typedASTValue(viaASTValue.fromValue) so per-element operations (e.g. arithmetic, string concatenation) work. Affects all languages; enables JavaScriptfor...ofover arrays. - Runtime fix — arithmetic/comparison on dynamically-typed operands: binary operators (
+ - * / % == != > < …) dispatched on the operand's staticASTValue.typeand only handled concrete primitives, so twodynamic/var/Objectoperands (e.g. untyped JavaScript parameters) threwCan't perform '+' operation with types: dynamic + dynamiceven when the runtime values were real numbers/strings.ASTExpressionOperation.runnow resolves each "boxed"/untyped operand to its concreteASTValue(viaASTValue.fromValue) before dispatching. Affects all languages; enables executing parsed JavaScript arithmetic. - JavaScript
/is now floating-point division (ASTExpressionOperator.divideAsDouble), matching JS semantics (7 / 2 === 3.5) instead of integer division. - JavaScript arrow functions: a named arrow assignment (
const add = (a, b) => a + b;,const square = n => n * n;,const greet = () => { … };) is parsed and desugared to a named function declaration — callable by name (add(1, 2)), at top level or as a local statement, with expression or block bodies. Translates to a regularfunction/method on output. Anonymous arrows passed as callbacks (true closures) are a follow-up. - Code generation fix — logical negation of a complex operand:
!(a > b)was emitted as!a > b(which re-parses as(!a) > b). The negated operand is now parenthesized when complex. Affects all languages. - Tests: broad JavaScript coverage added — parse + execute + translate (to Dart/Java where applicable) + re-execute the generated code:
javascript_basic_vars,branches,while_loop,for_loop,comparisons,division,negation,this_method, plus the earlierclass_function,control_flow,for_of,arithmetic, and arrow-function definitions. - Docs/examples: added per-language runnable examples under
example/—apollovm_example_java.dart,apollovm_example_kotlin.dartandapollovm_example_javascript.dart(each load + run + translate to Dart, with verified output) — and fixed the existingapollovm_example.darttoawait writeAllSources()(was printingInstance of 'Future<StringBuffer>'). README updated with a Kotlin section and the CLI banner now reads "Dart, Java, Kotlin and JavaScript".
0.1.27 #
-
Wasm collections — compound subscript assignment (P3, part 9):
m[k] += v(and-=,*=,/=,~/=) and the same for list indicesa[i] += vnow compile to Wasm. Lowered by desugaringc[k] OP= vintoc[k] = c[k] OP v, so it reuses the existing get/set codegen and works for maps (int/Stringkeys) and lists acrossint/doublevalues. Matches the interpreter on bothwasm_runand Chrome (e.g. a frequency counter can now usem[w] += 1directly).
-
Wasm collections — map parameters & returns (P3, part 8):
- Functions can now accept and return whole
Maps across the host boundary. The runner marshals a DartMapinto the module's map layout (header + parallel key/value buffers, via the exported__alloc) forMapparameters, and decodes a returned map-header pointer back into a DartMap. Coversint/Stringkeys ×int/double/String/boolvalues, including round-tripping and returning a map built withm[k] = v. - The
apollovm_sigcustom section now encodes a map type as[7, <key tag>, <value tag>], so raw-byte modules self-describe their key/value types. Element read/write was factored into shared helpers used by both list and map marshalling.
- Functions can now accept and return whole
-
Wasm collections — map
.keys/.values+ iteration (P3, part 7):m.keysandm.valuesnow compile to Wasm: each materializes a fresh list by copying the map's parallel key (or value) buffer (which already has the list element layout), sofor (var k in m.keys)/for (var v in m.values)work via the existing list for-each. Matches the interpreter on bothwasm_runand Chrome.- The for-each loop-variable type resolver now derives the element type from the map (
m.keys→ key type,m.values→ value type) so the loop variable is correctly typed.
-
Wasm collections — maps with
Stringkeys (P3, part 6):Map<String, V>now compiles to Wasm (V=int/double/String/bool): literals,m[k]get,m[k] = vset,.length/.isEmpty/.isNotEmpty, and.containsKey(k). Matches the interpreter on bothwasm_runand Chrome.- String keys are stored as i32 pointers and compared by content via a synthesized
__streq(a, b)helper (length check + byte loop), so e.g.containsKey("app")correctly returnsfalsefor a map keyed by"apple", and multi-byte UTF-8 keys work.
-
Wasm collections — maps with
intkeys (P3, part 5):Map<int, V>now compiles to Wasm (V=int/double/String/bool). A map value is an i32 pointer to a 16-byte header[length][capacity][keysPtr][valuesPtr]with parallel key/value buffers; lookup/set is a linear scan withi64key equality. Matches the interpreter on bothwasm_runand Chrome.- Supported: map literals (incl. empty
{}),m[k]get,m[k] = vset (in-place update or append, growing both buffers when full),.length,.isEmpty/.isNotEmpty, and.containsKey(k). - Also adds Wasm list index assignment
a[i] = v(the subscript-assignment AST node now lowers to Wasm for both maps and lists). - Out of scope for this slice:
Stringkeys (need a string-equality helper),.keys/.values/iteration, map parameters/returns, and compound subscript assignment (m[k] += v) — notem[k] = m[k] + 1already works.
-
Dart subscript assignment —
m[k] = vanda[i] = v(frontend + interpreter):- The grammar now parses container-entry assignment targets (previously the assignment left-hand side was only a bare variable, so
m[k] = v/a[i] = vfailed with aSyntaxError). Compound operators (+=,-=,*=,/=,~/=) are supported, e.g.m["x"] += 1for building a frequency map. - New AST node
ASTExpressionVariableEntryAssignment; newASTValue.writeKey/writeIndexwrite into the underlyingMap/Listin place. AMapis always written by key (even a numeric one); aListby index. Round-trips through the code generators (parse → regenerate → re-parse). - Empty collection inference fix: an empty
{}literal (typedMap<dynamic,dynamic>) is now assignable to a typed map such asMap<String,int>—ASTTypeMap.acceptsTypetreats adynamickey/value component as a wildcard, matching how lists already ignore their element type for assignment (soMap<String,int> m = {};works, likeList<int> a = [];).
- The grammar now parses container-entry assignment targets (previously the assignment left-hand side was only a bare variable, so
-
Dart
Mapsupport — frontend + interpreter (read/query; prerequisite for Wasm maps):- Grammar fix:
Map<K,V>type annotations now parse.mapTyped()was missing the value-type parser (it accepted onlyMap<K,>and read the,token as the value type), so everyMap<int,int>declaration failed with aSyntaxError. Key/value types also acceptList<...>(e.g.Map<String,List<int>>). - Map literals now infer their key/value types from entries (mirroring list literals) instead of being hardcoded to
Map<dynamic,dynamic>, soMap<int,int> m = {1:10}assigns cleanly.ASTExpressionMapLiteral.resolveTypereturns theMaptype (it previously returned just the value type). - Map index by key:
m[k]now does a key lookup for anyMap(the access was incorrectly routed to positional/list indexing whenever the key was numeric, so int-keyed maps failed). - New core
Mapclass (CoreClassMap): getters.length/.isEmpty/.isNotEmpty/.keys/.valuesand methods.containsKey/.containsValue/.remove/.clear..keys/.valuesresolve toList<keyType>/List<valueType>so iterating them yields properly-typed elements. - Maps work as function parameters.
- Note: map subscript assignment (
m[k] = v) is a follow-up (the grammar's assignment target is still a bare variable). - Functions can now accept and return whole lists across the host boundary. The runner marshals a Dart
Listinto module memory (header + elements buffer, via the exported__alloc) forListparameters, and decodes a returned list-header pointer back into a DartList. Coversint/double/String/boolelement lists, including round-tripping (List<int> echo(List<int> a)) and building a result with.addbefore returning it. - The
apollovm_sigcustom section now carries list types as[6, <element tag>](was a single opaque tag), so modules loaded from raw bytes self-describe their list element types; the runner uses 64-bit element reads/writes viaBigIntso it works on both the Dart VM and dart2js (Chrome). - A
String/Listparameter now also forces an exported__alloc(previously only String params did), so list-only functions can be fed their arguments.
- Grammar fix:
-
Wasm collections —
String&boolelement lists (P3, part 3):List<String>andList<bool>now compile to Wasm: literals, index readsa[i],for (var e in a),.add, and the.first/.last/.isEmpty/.isNotEmpty/.lengthgetters all work (elements stored as i32 — a string pointer or a0/1boolean). Matches the interpreter on bothwasm_runand Chrome.- Maps remain a later slice.
-
Wasm collections — growable lists
.add+ getters (P3, part 2):- List values are now an indirect handle: a 12-byte header
[length:i32][capacity:i32][dataPtr:i32]pointing at a separately-allocated elements buffer. This makes.addaliasing-safe — growing reallocates the data buffer (doubling capacity,memory.copying existing elements) and updates the header in place, so existing references observe the new length/contents. list.add(x)now compiles to Wasm forint/doublelists (including starting from an empty[]literal), growing linear memory on demand.- New list getters compiled to Wasm:
.first,.last,.isEmpty,.isNotEmpty. bool-returning functions loaded from raw Wasm bytes now decode correctly: theapollovm_sigcustom section is emitted forboolreturns (not just String signatures), and the runner maps the i320/1back to a Dartbool.
- List values are now an indirect handle: a 12-byte header
-
Wasm collections — lists, read + iterate (P3, part 1):
int/doublelist literals compile to linear-memory blocks; index readsa[i], the.lengthgetter, andfor (var e in a)now compile to Wasm (matching the interpreter, on bothwasm_runand Chrome).- Lists currently stay internal (return scalars); list parameters/returns and maps are later slices.
-
Wasm generator — major feature expansion (
ApolloGeneratorWasm), moving toward full Dart parity:- Loops:
whileandforloops now compile to Wasm (block/loop/br_if/br), includingreturnfrom inside a loop. Added thebropcode helper and recursion into loop bodies when collecting function locals. - Function calls: local function invocation (calling other top-level functions, including recursion) via a function-index table threaded through the generator and a
Wasm.call. - Operators: integer modulo
%(i64.rem_s), logical&&/||(i32.and/i32.or), logical negation!(i32.eqz), and unary minus-(f64.neg/i64multiply-by--1). - Booleans:
boolliterals andbool-typed locals (represented as Wasmi32). - Bug fix: the
== 0fast-path (i64.eqz) was incorrectly applied to any operator with a literal-0right operand (e.g.x > 0compiled asx == 0). It is now restricted to theequalsoperator. - Short-circuit
&&/||: now compile to anif/elseso the right operand is only evaluated when needed. The AST interpreter was also made short-circuiting, so interpreted and compiled execution stay consistent (and match Dart). - Full Dart
%semantics: integer and double modulo now return the Dart-correct non-negative result in[0, |b|)for negative operands (sign-corrected via scratch locals); double%is computed asa - trunc(a / b) * b. - Fix: compound assignment (
+=,-=,*=, …) emitted its operation to a discarded buffer (missingout/context), producing broken code; now applied to the real output.
- Loops:
-
Tests: added Wasm coverage for every feature above plus a combined integration test (prime counting / sum-of-squares using loops + calls + logic + modulo), all executed against the real compiled-and-run Wasm module.
-
Wasm strings — String parameters +
memory.grow(P2, part 5, completes the strings milestone):- Functions taking
Stringparameters now work: the runner encodes the Dart string into module memory (via the exported__alloc, guided by theapollovm_sigparam tags) and passes the i32 pointer. EnablesString echo(String s),String greet(String name), etc. - The allocator (both the exported
__allocand the inline concat allocator) now grows linear memory on demand (memory.size/memory.grow), so large strings/concatenations no longer trap.
- Functions taking
-
Wasm strings — number→string interpolation (P2, part 4):
- Interpolation of
int/double("n=$n","${a + b}") now compiles to Wasm via host importsenv.int_to_str/env.double_to_str; the host formats the number (matching the interpreter; doubles viaASTTypeDouble.doubleToString) and writes it into module memory. - Adds a synthesized, exported
__allocbump-allocator function so host imports can allocate strings in the module's memory (reentrant host→module calls), plus value-returning host imports and i64↔BigInt marshalling on the web.
- Interpolation of
-
Wasm strings — String-returning functions (P2, part 3):
- Functions returning
Stringnow work: the value is an i32 pointer the runner decodes back into a DartString. - Modules are now self-describing: a custom
apollovm_sigsection records each public function's high-level return/parameter type tags, so the runner can marshal strings even for modules loaded from raw bytes. Emitted only when a public signature involves aString(pure-numeric modules stay byte-identical).
- Functions returning
-
Wasm strings — concatenation + bump allocator (P2, part 2):
- A mutable heap-pointer Global (
$hp) bump allocator; runtime string allocation via__alloc+memory.copy. - String
+, adjacent string literals, and$varinterpolation ofStringvariables now compile to Wasm (left-folded binary concatenation producing a fresh[len:i32][utf8]string). Validated onwasm_runand Chrome. - Note: bump-and-leak (no free yet); number→string interpolation and string returns are later slices.
- A mutable heap-pointer Global (
-
Wasm linear-memory foundation + strings (P2, part 1 —
printof string literals):- The generator now emits Import / Memory / Global / Data sections and offsets the function-index space past imported functions (a body-first two-pass build). Modules with no strings/imports remain byte-identical.
- String literals are interned into a static data segment as
[len:i32][utf8]; aStringvalue is ani32pointer into the exported linear memory. print(stringLiteral)lowers to a host importenv.print(i32). The runtime layer (WasmRuntime/WasmModule) now wires host imports at instantiation and exposes exported memory reads, on both the native (wasm_run) and browser runtimes; the runner decodes the pointer and routes toexternalPrintFunction.- New
wasm.dartmemory opcodes (i32/i64 load/store, load8_u/store8, memory.size/grow/copy/fill) and section-id helpers.
-
Test infrastructure — WebAssembly GC validation path:
- Established a browser (
dart test -p chrome) parity harness that runs generated Wasm on Chrome's own engine. The nativewasm_runbackend (wasmtime 14 / wasmi 0.31) does not support the WebAssembly GC proposal; Chrome (v119+) does. - Added a
wasm-gctest tag (dart_test.yaml) and a WasmGC capability spike; CI'swasm_run-based jobs exclude the tag (--exclude-tags wasm-gc) while the Chrome job runs it. This gates the planned dual-target (linear-memory + WasmGC) backend work.
- Established a browser (
-
Bug fixes:
- Loop
returnpropagation: areturninside afor,while, orfor-eachloop was ignored (the loop shadowedrunStatuswith a fresh instance and never broke on return). Returns now propagate and stop iteration correctly. ASTTypeequality:ASTTypeBool,ASTTypeString,ASTTypeObject,ASTTypeConstructorThis,ASTTypeVar,ASTTypeDynamic,ASTTypeNull, andASTTypeVoidmistakenly checkedother is ASTTypeInt, so equal instances never compared equal. Each now checks its own type.ASTTypeMap: building a map from a flat key/value list read from the (empty) target map instead of the input list, producing an empty map.- Java generator (
_escapeString): backslashes were not escaped, producing invalid Java string literals (e.g."a\b"instead of"a\\b"). ASTExpression.literalNumTypereturnedASTNumType.intfordoubleliterals.- Corrected the operator symbol shown in
ASTValueString/ASTValueNumcomparison/equality error messages.
- Loop
-
Tests:
- Increased line coverage from ~64.6% to ~70.9%.
- Added regression tests for all the fixes above and extensive unit/integration tests for
ASTValue,ASTType,ApolloVM, expressions, the core library, and the Wasm generator.
-
Dependencies:
- data_serializer: ^1.2.1 -> ^1.2.2
- test: ^1.31.0 -> ^1.31.1
0.1.26 #
DartGrammarDefinition:- Updated
getTypeByNameto treat'const'as an unmodifiable variable type alongside'final'. - Modified
classFieldDeclaration,constructorTypedParameterDeclaration,statementVariableDeclaration, andparameterDeclarationparsers to accept bothfinalandconsttokens as optional modifiers. - Adjusted logic in
statementVariableDeclarationto recognize'const'as unmodifiable and handle it similarly to'final'.
- Updated
0.1.25 #
ApolloCodeGeneratorDart:generateASTExpression:- Fixed string template merging logic to correctly handle variable accesses and literal strings by swapping checks on
expression1andexpression2. - Improved merging of adjacent quoted strings with different quote types by adding
_tryMergeQuotedStringsand related helper methods. - Added robust checks for unescaped quotes inside strings to safely convert quote types.
- Fixed string template merging logic to correctly handle variable accesses and literal strings by swapping checks on
- Added helper methods:
_isQuotedString,_isSingleQuoteString,_isDoubleQuoteString_canConvertQuote,_convertQuote_mergeQuotedStrings,_tryMergeQuotedStrings
DartGrammarDefinition:- Refactored expression parsing to delegate expression operation precedence and logical operator handling to
computeFinalExpression.
- Refactored expression parsing to delegate expression operation precedence and logical operator handling to
DartGrammarLexer:- Refactored to extend new
BaseGrammarLexerabstract class. - Moved common lexer methods and token handling to
BaseGrammarLexer. - Updated whitespace and comment parsers to static methods for reuse.
- Refactored to extend new
BaseGrammarLexer(new):- Added as base class for grammar lexers with common token and identifier parsing.
- Added expression operation precedence handling via
computeFinalExpressionandreduceExpressionBlock.
Java11GrammarLexer:- Refactored to extend
BaseGrammarLexer. - Removed duplicated token and identifier parsing code.
- Updated whitespace and comment parsers to static methods.
- Refactored to extend
Java11GrammarDefinition:- Refactored expression parsing to use
computeFinalExpressionfor operator precedence.
- Refactored expression parsing to use
- Tests:
- Added comprehensive Dart arithmetic and logical expression tests covering operator precedence, mixed numeric types, and complex expressions.
- Updated multiple Dart and Java11 test definitions to normalize expression grouping from
a + (b + c)to(a + b) + cfor consistent operator associativity. - Fixed string concatenation tests to correctly merge adjacent string literals and variables.
- Updated WASM tests to fix generated bytecode for integer operations.
- Fixed linear regression and forecast tests with corrected arithmetic expressions.
- Improved test outputs to reflect corrected expression evaluation and string concatenation results.
0.1.24 #
-
ASTExpressionFunctionInvocationand related classes:- Added mixin
WithCallChainFunctionto support chained function invocations. - Added field
chainFunctionInvocationto hold chained calls. - Updated function invocation methods to generate chained calls in code generation (
ApolloCodeGenerator). - Updated runtime execution to process chained function calls after the main call.
- Added mixin
-
ApolloCodeGenerator:- Refactored function invocation code to use
_generateChainFunctionInvocationhelper for chained calls.
- Refactored function invocation code to use
-
Dart grammar (
dart_grammar.dart):- Updated
expressionGetterAccessparser to parse and attach chained function invocations.
- Updated
-
CoreClassPrimitive:- Removed
_functionToStringfield and initialization.
- Removed
-
CoreClassString:- Added
_functionToStringexternal class function returningself.toString().
- Added
-
CoreClassInt:- Added
_functionToStringexternal class function returningself.toString().
- Added
-
CoreClassDouble:- Added
_functionToStringexternal class function with custom logic:- If the double is an integer value, returns string with
.0suffix. - Otherwise, returns standard
toString().
- If the double is an integer value, returns string with
- Added
0.1.23 #
-
ASTExpressionVariableEntryAccess:- Replaced
_asyncTrywith_run2to improve element access with proper type casting. - Added generic
_readElement<V>method to read elements with type safety. - Updated
readIndexASTValueandreadKeyASTValueto return typedASTValue<V>.
- Replaced
-
ASTExpressionFunctionInvocationand subclasses:- Added support for chained function invocations via new
chainFunctionInvocationfield. - Updated
runmethods to invoke chained functions sequentially after the initial call. - Added
_callChainFunctionhelper to process chained calls asynchronously. - Added
ASTExpressionChainFunctionInvocationclass representing chained function calls. - Updated
toStringmethods to include chained function calls. - Updated constructors and parsing to support chained function invocations.
- Added support for chained function invocations via new
-
ASTExpressionObjectFunctionInvocation,ASTExpressionObjectEntryFunctionInvocation,ASTExpressionGroupFunctionInvocation:- Updated constructors and
runmethods to support chained function invocations. - Added caching of function class for performance.
- Improved error handling and function resolution with chained calls.
- Updated constructors and
-
lib/src/apollovm_code_generator.dart:- Updated code generator to output chained function invocations in generated code.
-
Grammar updates (
dart_grammar.dart,java11_grammar.dart):- Added parsing rules for chained function invocations (
expressionChainFunctionInvocation). - Updated function invocation parsers to parse and attach chained function calls.
- Added parsing rules for chained function invocations (
-
ASTValue:- Added generic static method
fromValue<V>to convert dynamic values to typedASTValue<V>. - Added
readIndexASTValue<V>andreadKeyASTValue<V>methods returning typedASTValue<V>.
- Added generic static method
-
CoreClassString:- Added new external string functions:
replaceFirst,trimLeft,trimRight,padLeft,padRight,lastIndexOf,codeUnitAt. - Registered new functions in
getFunctionwith case-insensitive support.
- Added new external string functions:
-
ASTClass:- Added
toStringoverride for better debug output.
- Added
0.1.22 #
-
ASTExpressionVariableEntryAccess:- Refactored
runmethod to use nestedresolveMappedcalls for asynchronous handling. - Added private helper
_asyncTryto unify index/key reading logic with async support. - Added private helper
__throwReadNPEto throw detailedApolloVMNullPointerExceptionwith stack trace on read failures. - Improved error messages for index/key read failures including variable, index/key, size, and value details.
- Refactored
-
ASTExpressionObjectEntryFunctionInvocation:- Added class-level documentation with code examples for usage of object entry function calls like
obj[i].fx(args)andobj[key].fx(args).
- Added class-level documentation with code examples for usage of object entry function calls like
-
ASTValue:- Updated
readKeymethod signature to accept nullableObject? keyparameter for better null safety.
- Updated
-
ASTValueStatic:- Updated
readKeymethod signature to accept nullableObject? key.
- Updated
0.1.21 #
CoreClassBaseandCoreClassPrimitive:- Added
_functionToStringexternal function returning the string representation of the instance.
- Added
CoreClassString,CoreClassInt,CoreClassDouble,CoreClassList:- Added support for the
toStringcore function, returning the respective_functionToString.
- Added support for the
0.1.20 #
-
ASTSingleLineStatementBlock:- Added new subclass of
ASTBlockthat allows only a single statement. - Overrides
addStatementto enforce single statement constraint. - Overrides
toStringto output the single statement without braces.
- Added new subclass of
-
ApolloCodeGenerator:- Added support for
ASTSingleLineStatementBlockingenerateASTNodedispatch. - Added
generateASTSingleLineStatementBlockmethod to generate single-line statement blocks. - Updated
generateASTBlockto delegate togenerateASTSingleLineStatementBlockif block is single-line. - Updated
generateASTBranchIfBlockto generate single-line blocks without braces.
- Added support for
-
ApolloGenerator:- Added abstract method
generateASTSingleLineStatementBlock. - Added support for
ASTSingleLineStatementBlockingenerateASTNodedispatch.
- Added abstract method
-
ApolloGeneratorWasm:- Implemented
generateASTSingleLineStatementBlockto generate the single statement.
- Implemented
-
Dart and Java11 grammars:
- Added
ASTSingleLineStatementBlockparsing support. - Added
codeBlockOrSingleLineBlockparser to accept either a block or a single-line block. - Updated
branchIfBlockparser to accept single-line blocks as branch bodies.
- Added
0.1.19 #
-
Added new AST statement classes:
ASTStatementBlockrepresenting a block of statements.ASTStatementFunctionDeclarationrepresenting a function declaration statement.
-
ApolloCodeGenerator:- Added support for generating code for
ASTStatementFunctionDeclarationandASTStatementBlock. - Added methods
generateASTStatementFunctionDeclarationandgenerateASTStatementBlock.
- Added support for generating code for
-
ApolloGeneratorinterface:- Added abstract methods
generateASTStatementFunctionDeclarationandgenerateASTStatementBlock. - Updated statement dispatch to handle
ASTStatementFunctionDeclarationandASTStatementBlock.
- Added abstract methods
-
ApolloGeneratorWasm:- Added
generateASTStatementBlockimplementation. - Added stub for
generateASTStatementFunctionDeclaration(throwsUnimplementedError).
- Added
-
apollovm_ast_statement.dart:- Added
ASTStatementBlockclass wrapping anASTBlockwith proper context and run behavior. - Added
ASTStatementFunctionDeclarationclass wrapping anASTFunctionDeclarationwith run behavior registering the function in the context.
- Added
-
apollovm_ast_toplevel.dart:- Extended
ASTFunctionDeclarationwith:toASTValueFunctionmethod to convert toASTValueFunction.toFunctionmethod to convert to a DartFunctionwith limited support for zero or one positional parameter.resolveFunctionTypeandcallFunctionTypedhelpers for function type resolution and invocation.
- Extended
-
apollovm_ast_type.dart:- Added
ASTTypeFunctionrepresenting function types with optional return type and parameters. - Added
callCastedhelper method for generic type casting.
- Added
-
apollovm_ast_value.dart:- Added
ASTValueFunctionwrapping a DartFunctionwith proper type and invocation support. - Implemented equality, hashCode, and string representation for
ASTValueFunction.
- Added
-
apollovm_utils.dart:- Added
resolveGeneric<T>()helper function for generic type resolution.
- Added
-
dart_grammar.dart:- Extended grammar to parse function declarations as top-level definitions and statements.
- Added parsing support for
ASTStatementFunctionDeclarationandASTStatementBlock. - Allowed optional return type in function declarations.
- Updated statement parser to include function declarations and blocks.
0.1.18 #
-
ASTExpressionObjectEntryFunctionInvocation:- Added new AST expression class to represent calls to class object entry functions.
- Implements function resolution and invocation on class instances or static context.
- Overrides
runandtoStringmethods for execution and debugging.
-
ApolloCodeGenerator:- Added support for generating code for
ASTExpressionObjectEntryFunctionInvocation. - Updated
generateASTExpressionmethod to handleASTExpressionObjectEntryFunctionInvocation.
- Added support for generating code for
-
ApolloGeneratorinterface:- Added abstract method
generateASTExpressionObjectEntryFunctionInvocation.
- Added abstract method
-
ApolloGeneratorWasm:- Added stub implementation for
generateASTExpressionObjectEntryFunctionInvocationthrowingUnimplementedError.
- Added stub implementation for
-
Dart and Java11 grammars:
- Added parsing rule
expressionObjectEntryFunctionInvocationto support syntax for object entry function invocation expressions.
- Added parsing rule
0.1.17 #
- Added
ApolloImportManagerto manage package/library imports and resolve core packages. VMContext:- Made sealed class.
- Added
importManagerfield andimportmethod to support import resolution and delegation to parent contexts. - Updated function and external function lookup to consider imported functions.
- Added
VMScopeContextas a final subclass ofVMContextfor scoped runtime contexts. - Updated
VMClassContextand other runtime contexts to be final and useVMScopeContextfor nested scopes. ASTStatementImport:- New AST node to represent import statements.
- Supports running import in a context, throwing on failure.
ASTRoot:- Supports tracking and running import statements.
- Considers imported functions in function resolution.
ApolloRunner:- Added
importManagerfield and initialization with default import manager. - Supports auto-import of
dart:mathcore package. - Passes
importManagerto execution and function lookup calls.
- Added
CorePackageBaseandCorePackageMath:- Added
pathgetter for core package identification.
- Added
- Code generators (
dart,java11,wasm):- Added support for generating import statements (
ASTStatementImport).
- Added support for generating import statements (
- Dart and Java11 grammar:
- Added parsing of import statements into
ASTStatementImport.
- Added parsing of import statements into
- Test framework:
- Added support for
auto-import-dart-mathattribute in test XML. - Tests updated to import
dart:mathand usepowfunction.
- Added support for
- Various runtime and AST classes:
- Updated to use
VMScopeContextinstead of baseVMContextfor nested scopes. - Updated
VMObjectfield value methods to useVMScopeContext.
- Updated to use
- Minor fixes and improvements in import handling, context management, and code generation.
0.1.16 #
DartGrammarDefinition:- Changed type of
finalExpressionOpfromASTExpressionOperation?toASTExpression?. - Updated cast of
expressionOpfromASTExpressionOperationtoASTExpression.
- Changed type of
0.1.15 #
-
ApolloCodeGenerator:generateASTValueDouble: replaced manual double string formatting withASTTypeDouble.doubleToStringfor consistent double string representation.
-
ASTStatementVariableDeclaration:_runImpl2: updated type cast check to allow dynamic type to bypass cast validation.
-
ASTTypeDouble:- Added static method
doubleToStringto format double values consistently, optionally allowing scientific notation. - Updated
toStringmethod ofASTTypeNumto return'num'instead of'double'.
- Added static method
-
ASTValueAsStringandASTValuesListAsString:- Updated string conversion to use
valueToStringmethod that formats doubles usingASTTypeDouble.doubleToString.
- Updated string conversion to use
-
CorePackageMath:- Updated math function external static function wrappers to explicitly type parameters as
numand returnASTTypeDouble.instancefor functions returning double values.
- Updated math function external static function wrappers to explicitly type parameters as
-
Test framework (
apollovm_languages_test_definition.dart):- Moved output printing before output assertion in
_testCallfor clearer test logs.
- Moved output printing before output assertion in
0.1.14 #
- Added new
ASTExpressionsubclassASTExpressionNegativeto represent unary negative expressions. - Added new
ASTExpressionsubclassASTExpressionGroupFunctionInvocationto represent function calls on grouped expressions (e.g.,(-d).toStringAsFixed(4)). ApolloCodeGenerator:- Updated
generateASTExpressionto handleASTExpressionNegativeandASTExpressionGroupFunctionInvocation. - Added methods
generateASTExpressionNegativeandgenerateASTExpressionGroupFunctionInvocation. - Refactored function invocation code into private
_generateFunctionInvocationhelper.
- Updated
ApolloGeneratorinterface:- Added abstract methods
generateASTExpressionNegativeandgenerateASTExpressionGroupFunctionInvocation. - Updated
generateASTExpressionto support new expression types.
- Added abstract methods
apollovm_ast_expression.dart:- Added implementation of
ASTExpressionNegativewith type resolution, runtime evaluation, and string representation. - Added implementation of
ASTExpressionGroupFunctionInvocationwith function resolution and invocation logic.
- Added implementation of
- Dart and Java11 grammars:
- Added parsing support for unary negative expressions (
-expr). - Added parsing support for group function invocations (e.g.,
(expr).func(args)).
- Added parsing support for unary negative expressions (
ApolloGeneratorWasm:- Added stub implementations for
generateASTExpressionNegativeandgenerateASTExpressionGroupFunctionInvocation. - Updated expression generation dispatch to handle new expression types.
- Added stub implementations for
0.1.13 #
-
ASTStatementWhileLoop:- Added new AST node class representing a while loop statement.
- Implemented
runmethod to execute the loop with proper context handling. - Added type resolution returning
ASTTypeVoid.instance. - Added children and node resolution methods.
-
ApolloCodeGenerator:- Added support for generating code for
ASTStatementWhileLoopingenerateASTStatement. - Implemented
generateASTStatementWhileLoopmethod to generate while loop source code.
- Added support for generating code for
-
ApolloGenerator:- Added abstract method
generateASTStatementWhileLoop. - Added dispatch for
ASTStatementWhileLoopingenerateASTStatement.
- Added abstract method
-
DartGrammarDefinition:- Added
statementWhileLoopparser to parse while loop statements. - Integrated
statementWhileLoopinto the mainstatementparser.
- Added
-
Java11GrammarDefinition:- Added
statementWhileLoopparser to parse while loop statements. - Integrated
statementWhileLoopinto the mainstatementparser.
- Added
-
ApolloGeneratorWasm:- Added stub for
generateASTStatementWhileLoopmethod throwingUnimplementedError. - Added dispatch for
ASTStatementWhileLoopingenerateASTStatement.
- Added stub for
-
Tests:
- Added new test
dart_basic_printFibonacci.test.xmldemonstrating while loop usage in Dart source and generated code.
- Added new test
0.1.12 #
-
ASTInvocableDeclaration:- Replaced
ASTFunctionDeclarationwith genericASTInvocableDeclarationfor function and constructor declarations. - Added
ASTClassConstructorDeclarationfor class constructors with support forthisparameters. - Added
resolveRuntimeTypemethod to support runtime type resolution with context and node. - Updated
callandrunmethods to support async and context-aware execution. - Added
initializeVariablesfor constructor variable initialization.
- Replaced
-
ASTParametersDeclaration:- Made generic over parameter type
P. - Added
ASTConstructorParametersDeclarationandASTFunctionParametersDeclarationsubclasses. - Updated parameter accessors and type checks to use generic parameter type.
- Made generic over parameter type
-
ASTParameterDeclaration:- Added
ASTConstructorParameterDeclarationwiththisParameterflag. - Added extensions for filtering
thisparameters.
- Added
-
ASTFunctionSetandASTConstructorSet:- Introduced generic base
ASTInvokableSetwith single and multiple implementations. - Added
ASTConstructorSetfor constructors, similar to function sets.
- Introduced generic base
-
ASTClassNormal:- Added support for constructors with
ASTConstructorSet. - Added methods to add, get, and check constructors by name and signature.
- Updated
resolveNodeto resolve constructors.
- Added support for constructors with
-
ASTRoot:- Updated
getFunctionto return constructors if matching class name and signature.
- Updated
-
ASTExpressionandASTValue:- Added
resolveRuntimeTypeandgetHashcodeValuemethods for runtime type and value hashing. - Updated equality and hashCode to use
getHashcodeValue.
- Added
-
ASTExpressionFunctionInvocationand subclasses:- Updated to use
ASTInvocableDeclarationfor function retrieval. - Updated
runmethod to support async and context-aware invocation.
- Updated to use
-
ASTExpressionObjectGetterAccess:- Updated getter retrieval and runtime type resolution to support async and context-aware evaluation.
- Added
_runGetterhelper for getter invocation.
-
ASTStatementVariableDeclaration:- Added
unmodifiableflag. - Updated type resolution and run implementation to use
resolveRuntimeType.
- Added
-
ASTType:- Added
ASTTypeConstructorThissingleton for constructorthisparameter. - Added
resolveRuntimeTypemethod.
- Added
-
ASTVariable:- Added
resolveRuntimeTypemethod.
- Added
-
CorePackageBaseandCoreClassMixin:- Updated external function and class function creation to use
ASTFunctionParametersDeclaration.
- Updated external function and class function creation to use
-
CoreClassList:- Added
firstandlastgetters with runtime component type resolution. - Added empty constructor list and related methods.
- Added
-
DartGrammarDefinitionandJava11GrammarDefinition:- Added parsing support for class constructors with parameters and optional blocks.
- Updated function and constructor parameter parsing to use
ASTFunctionParametersDeclarationandASTConstructorParametersDeclaration. - Added parsing for
thisconstructor parameters.
-
ApolloCodeGeneratorDartandApolloCodeGeneratorJava11:- Added
generateASTClassConstructorDeclarationmethod to generate constructor code. - Updated function parameter generation to use generic parameter declaration.
- Added
-
ApolloParserWasm:- Updated WASM function parsing to use
ASTFunctionParametersDeclaration.
- Updated WASM function parsing to use
-
Test:- Added new test
dart_basic_linearRegression.test.xmlwith Dart source for linear regression and forecast. - Added new test
dart_basic_calculateShippingCost.test.xmlfor shipping cost calculation. - Updated test runner to include new tests.
- Added new test
0.1.11 #
-
ASTValueNum:frommethod:- Added optional
asDoubleparameter to control numeric type coercion. - Improved parsing logic to preserve numeric intent from strings containing decimal points or exponents by forcing double representation.
- Added error handling for unsupported input types when
asDoubleis specified.
- Added optional
-
Added
ASTExpressionNullValueclass to representnullliteral expressions. -
ASTScopeVariable:- Special handling for variable named
'null'to resolve asASTValueNull.
- Special handling for variable named
-
ApolloCodeGenerator:- Added
generateASTExpressionNullValuemethod to generate code fornullexpressions. - Updated
generateASTExpressionto handleASTExpressionNullValue. generateASTValueDouble:- Fixed formatting of double values to ensure consistent decimal representation.
- Added handling to convert scientific notation doubles to fixed decimal format with appropriate fraction digits.
- Added helper method
fractionDigitsFromScientificNotationto determine the number of fraction digits needed for doubles in scientific notation.
- Added
-
ApolloGeneratorinterface:- Added
generateASTExpressionNullValuemethod. - Updated
generateASTExpressionto handleASTExpressionNullValue.
- Added
-
ApolloRunner:- Added optional
importCorePackageMathparameter to constructor andcreateRunnermethod. - When
importCorePackageMathis true, maps math functions fromCorePackageMathto external functions.
- Added optional
-
CorePackageMath:- New core package providing Dart
dart:mathfunctions as external functions for ApolloVM. - Includes
pow,sqrt,sin,cos,tan,asin,acos,atan,atan2,log,exp,abs,min,max.
- New core package providing Dart
-
Language grammars (
dart,java11):- Added parsing support for
nullliteral expressions producingASTExpressionNullValue.
- Added parsing support for
-
Language runners (
dart,java11,wasm):- Added support for
importCorePackageMathparameter in constructors.
- Added support for
-
ApolloGeneratorWasm:- Added stub for
generateASTExpressionNullValuethrowingUnimplementedError. - Updated
generateASTExpressionto handleASTExpressionNullValue.
- Added stub for
-
Test framework:
- Added new test
dart_basic_stdv.test.xmldemonstrating usage of math functions (pow,sqrt) andnullchecks. - Updated test runner to create runners with
importCorePackageMath: trueto enable math functions in tests.
- Added new test
0.1.10 #
ASTAssignmentOperator:- Added new operator
divideAsIntwith symbol'~/'. - Updated
asASTExpressionOperatorgetter to supportdivideAsInt. - Updated
getASTAssignmentOperatorandgetASTAssignmentOperatorTextto handledivideAsIntand its assignment form'~/='.
- Added new operator
ASTExpressionVariableAssignment:- Added support for
divideAsIntoperator in evaluation and string representation.
- Added support for
- Dart grammar (
dart_grammar.dart):- Extended
assigmentOperatorparser to recognize'~/='operator.
- Extended
- Java11 grammar (
java11_grammar.dart):- No changes for
divideAsIntoperator (remains unsupported).
- No changes for
0.1.9 #
-
ASTExpressionListLiteral:resolveType: updated to returnASTTypeArrayof the specified type or deduced common element type.children: fixed to includetypecorrectly.
-
ASTStatementVariableDeclaration:- Constructor enhanced to handle
ASTExpressionListLiteralvalues with type adjustments or cast exceptions.
- Constructor enhanced to handle
-
ASTStatementForEach:- Added
variableTypefield. - Constructor updated to accept
variableType.
- Added
-
ASTType:- Added
commonTypemethod to find common compatible type between two types.
- Added
-
ASTTypeArray:toValue: improved to castASTValueArrayto correct generic type if needed.
-
ASTValueArray:- Added
castmethod to convert to another generic type with optional component type.
- Added
-
Dart grammar (
dart_grammar.dart):statementForEachparser updated to parse explicit variable type before variable name.expressionListLiteralparser updated to infer common element type if not specified.
-
Java11 grammar (
java11_grammar.dart):statementForEachparser updated to parse explicit variable type before variable name.
-
Tests:
- Added Dart test for
findMax(List<int> numbers)function with multiple test cases including empty list handling.
- Added Dart test for
0.1.8 #
-
ASTStatementForEach:- Added new AST statement class representing a for-each loop with a variable name, iterable expression, and loop block.
- Implements
runmethod to iterate over an iterable AST value, declaring the loop variable in a nested context and running the loop block. - Resolves type as
void.
-
ApolloCodeGenerator:- Added support for generating code for
ASTStatementForEachingenerateASTStatement. - Implemented
generateASTStatementForEachmethod to output a for-in loop syntax with variable declaration and loop block.
- Added support for generating code for
-
ApolloGenerator:- Added abstract method
generateASTStatementForEach. - Updated
generateASTStatementto dispatch togenerateASTStatementForEachforASTStatementForEach.
- Added abstract method
-
Dart language grammar (
dart_grammar.dart):- Added parser
statementForEachto parse Dart-style for-each loops (for (var x in iterable) { ... }). - Added helper parser
_forEachVariableDeclto parse optionalvarorfinalbefore variable name.
- Added parser
-
Java language grammar (
java11_grammar.dart):- Added parser
statementForEachto parse Java-style for-each loops (for (Type var : iterable) { ... }).
- Added parser
0.1.7 #
-
CI:
.github/workflows/dart.yml: updatedactions/checkoutfrom v3 to v6 andcodecov/codecov-actionfrom v3 to v5.
-
apollovm.dart:- Exported new utility file
src/apollovm_utils.dart.
- Exported new utility file
-
apollovm_runner.dart:ApolloRunner:executeClassMethod: changed to async, added parameter normalization before execution.- Added
normalizeParametersmethod to normalize positional and named parameters against AST function declarations. executeFunction: added parameter normalization for top-level functions.- Improved parameter handling for function execution.
-
apollovm_utils.dart(new):- Added utilities for generic typed list conversion and case-insensitive map key lookup.
- Extensions on
Listfor typed list creation and onMapfor case-insensitive key lookup.
-
apollovm_ast_toplevel.dart:ASTFunctionDeclaration:- Added
normalizeParameters,normalizePositionalParameters, andnormalizeNamedParametersmethods to convert and normalize parameters according to function declarations.
- Added
- Added extension
IterableASTFunctionDeclarationExtensionwithresolveBestMatchBySignatureto select best matching function overload by parameter signature.
-
apollovm_ast_type.dart:ASTType:- Added
fromTypefactory to create ASTType from DartType. - Added
toASTValuemethod to convert native values to ASTValue according to type.
- Added
- Added
toASTValueoverrides in primitive and collection types (ASTTypeBool,ASTTypeNum,ASTTypeInt,ASTTypeDouble,ASTTypeString,ASTTypeNull,ASTTypeVoid,ASTTypeArray,ASTTypeArray2D,ASTTypeMap,ASTTypeFuture). - Added static
fromTypemethods forASTTypeArrayandASTTypeMapto create instances from Dart generic types. ASTTypeArrayandCoreClassList:- Added typed singleton instances for common generic types (e.g.,
List<String>,List<int>, etc.). - Added factory constructors and
fromTypemethods to resolve types generically.
- Added typed singleton instances for common generic types (e.g.,
ASTTypeMap:- Added
fromTypemethod for common map generic types.
- Added
ASTTypeFuture:- Added
toASTValueoverride to handle conversion from native or future values.
- Added
-
apollovm_ast_value.dart:ASTValue.fromfactory:- Added support for
ASTTypeBoolto createASTValueBool.
- Added support for
-
apollovm_core_base.dart:ApolloVMCore.getClass:- Added optional
genericsparameter. Listclass resolution now usesCoreClassList.fromTypewith generic type.
- Added optional
CoreClassList:- Converted to generic class
CoreClassList<T>. - Added typed singleton instances for common generic types.
- Added
fromTypestatic method to resolve generic list classes. - Constructor updated to accept generic type and resolve
ASTTypeArrayaccordingly.
- Converted to generic class
-
wasm_runner.dart:ApolloRunnerWasm:- Added parameter normalization before calling Wasm functions.
-
wasm_runtime.dart:- Added
ensureBooted()method andlastBootErrorgetter toWasmRuntimeinterface.
- Added
-
wasm_runtime_dart_html.dart,wasm_runtime_generic.dart,wasm_runtime_web.dart:- Implemented
ensureBooted()as no-op andlastBootErroras null.
- Implemented
-
wasm_runtime_io.dart:- Added boot logic with error capture.
- Implemented
ensureBooted()to call boot. - Added
lastBootErrorgetter.
-
Tests (
apollovm_languages_test_definition.dart):- Updated
_parseJsonListto return untypedListwithout generic type conversion. - Removed redundant generic list conversion helpers from test file.
- Updated tests to call
.toListOfType()extension for typed list checks.
- Updated
-
Tests (
apollovm_wasm_test.dart):- Added call to
wasmRuntime.ensureBooted()before checking support. - On unsupported runtime, print last boot error for diagnostics.
- Added call to
0.1.6 #
-
Added support for external getters in
ApolloVM:- New class
ApolloExternalGetterMapperto map Dart getters to ApolloVM. - Added
getGetterandgetMappedExternalGettermethods inVMContextfor getter resolution. - Extended
ASTBlockwith getter management (addGetter,getGetter, etc.). - Added
ASTGetterDeclarationand related classes (ASTClassGetterDeclaration,ASTExternalGetter,ASTExternalClassGetter) to represent getters in the AST. - Added
ASTExpressionGetterAccessbase class and subclassesASTExpressionLocalGetterAccessandASTExpressionObjectGetterAccessfor getter expressions. - Updated
DartGrammarDefinitionto parse getter access expressions. - Updated
ApolloCodeGeneratorandApolloGeneratorinterfaces and implementations to generate code for getter access expressions. - Added
externalGetterMapperfield toVMContextto support external getter mapping.
- New class
-
Core library updates:
- Added
CoreClassListclass implementing coreListtype support with external class functions and getters for common list operations (add,remove,length,isEmpty,sublist, etc.). - Refactored core class base and primitive classes to use
CoreClassMixinfor external function and getter creation.
- Added
0.1.5 #
-
ASTExpressionOperator:- Added new operators:
remainder,and,or. - Updated
getASTExpressionOperatorandgetASTExpressionOperatorTextto support%,&&, and||.
- Added new operators:
-
ASTExpressionOperation:- Updated
resolveTypeto handleremainder,and, andoroperators. - Added evaluation methods:
operatorRemainderfor%operator supporting int and double operands.operatorAndandoperatorOrfor logical&&and||with boolean coercion.
- Added private helper
_toBooleanto convert variousASTValuetypes to boolean. - Updated
throwOperationErrorto handle new operators.
- Updated
-
ASTValueand subclasses:- Added
%operator support inASTValueNum,ASTValueInt, andASTValueDouble. - Fixed incorrect error messages in base
ASTValueoperator overrides. - Added
operator ~/(ASTValue other)implementations inASTValueIntandASTValueDouble. - Updated operator return types for numeric operations to be more specific (
ASTValueNum).
- Added
-
DartGrammarDefinition:- Extended
expressionOperatorparser to recognize%,&&, and||. - Updated expression parsing logic to:
- Split expressions into blocks separated by logical operators
&&and||. - Resolve
%operator with higher precedence within blocks. - Correctly build AST for logical expressions combining blocks with
&&and||.
- Split expressions into blocks separated by logical operators
- Extended
-
WasmGenerator:- Added default case throwing
UnsupportedErrorfor unsupported operators in WASM code generation.
- Added default case throwing
0.1.4 #
-
ASTTypeVar:- Added
unmodifiablefield to distinguishvarandfinaltypes. - Added static instance
instanceUnmodifiableforfinal. - Updated constructor to accept
unmodifiableflag and set name accordingly. - Updated
toStringand equality to reflectunmodifiablestate.
- Added
-
ApolloVMCore:- Added support for
doubleandDoublecore classes returningCoreClassDouble.
- Added support for
-
CoreClassPrimitive:- Added helper
_externalClassFunctionArgs2for external class functions with two parameters.
- Added helper
-
CoreClassString:- Added many new external class functions:
length,isEmpty,isNotEmptysubstring,indexOf,startsWith,endsWithtrim,split,replaceAll
- Updated
getFunctionto support these new string functions.
- Added many new external class functions:
-
CoreClassInt:- Added external static function
tryParse. - Added external class functions:
compareTo,abs,sign,clamp,remainder,toRadixString,toDouble
- Updated
getFunctionto support new int functions.
- Added external static function
-
Added new class
CoreClassDouble:- External static functions:
parseDouble(aliasparse),tryParse,valueOf. - External class functions:
compareTo,abs,sign,clamp,remainder,toStringAsFixed,toStringAsExponential,toStringAsPrecision,toInt,round,floor,ceil,truncate. - Implements
getFunctionto provide these functions.
- External static functions:
-
ApolloCodeGeneratorDart:- Improved string literal concatenation handling:
- Added support for concatenating multiple string literals including raw and multiline strings.
- Added helper
writeAllStringsto write concatenated string parts correctly. - Improved splitting and merging of string literal blocks to avoid unnecessary concatenations.
- Preserves multiline string formatting and raw string prefixes.
- Improved string literal concatenation handling:
-
DartGrammarDefinition:- Added support for
finalkeyword returningASTTypeVar(unmodifiable: true). - Updated
literalStringparser to support concatenation of multiple string literals intoASTValueStringConcatenation.
- Added support for
-
Java11GrammarDefinition:- Added support for
finalkeyword returningASTTypeVar(unmodifiable: true).
- Added support for
0.1.3 #
-
DartGrammarDefinition:getTypeByName: added support for Dart typesvoidandbool.
-
DartGrammarLexer:stringContentQuotedLexicalTokenEscaped: added handling of unnecessary escape sequences for characters(,),{,}, and space in string literals.
-
Tests:
- Added
dart_basic_sumOrDouble.test.xmlwith a test for a Dart functionsumOrDouble. - Added
dart_basic_main_print_multi_line.test.xmltesting multi-line string printing. - Added
dart_basic_main_print_unnecessary_escape.test.xmltesting string literals with unnecessary escape sequences and ASCII art printing.
- Added
0.1.2 #
-
ApolloCodeGeneratorandApolloCodeGeneratorDart:generateASTExpressionOperation: updated to conditionally group complex expressions with parentheses based on operator and presence of literal strings to improve expression formatting and string interpolation merging.- Improved string concatenation merging for
addoperator when involving variables and literal strings.
-
ASTExpressionand subclasses (ASTExpressionOperation,ASTExpressionVariableAssignment,ASTExpressionVariableDirectOperation,ASTExpressionNegation,ASTExpressionFunctionInvocation, etc.):- Added
isComplexgetter to distinguish complex expressions. - Added
hasLiteralStringandhasDescendantLiteralStringto detect literal strings in expression trees. - Updated
toStringmethods to support optional grouping with parentheses for clarity. - Updated
ASTExpressionOperation.toStringto optionally wrap expressions in parentheses. - Updated
ASTExpressionVariableAssignmentandASTExpressionVariableDirectOperationto provide detailedtoStringimplementations reflecting operators. - Added
childrenOperationsanddescendantChildrenOperationshelpers for expression traversal.
- Added
-
ASTAssignmentOperatorenum:- Added
symbolfield for operator symbol representation.
- Added
0.1.1 #
-
lib/apollovm.dart:- Added library-level documentation describing ApolloVM as a portable VM supporting Dart, Java, and WebAssembly compilation.
- Changed
library apollovm;to a library directive without a name.
-
AST classes (
lib/src/ast/):- Updated
childrengetters to use null-aware spread operators (...?and?) for optional fields in:ASTExpressionListLiteralASTExpressionMapLiteralASTStatementVariableDeclarationASTBranchIfElseBlockASTBranchIfElseIfsElseBlockASTTypeASTTypeGenericVariable
- Updated
-
pubspec.yaml:- Updated dependencies:
petitparserfrom^6.1.0to^7.0.2lintsfrom^3.0.0to^6.1.0dependency_validatorfrom^3.2.3to^5.0.5xmlfrom^6.5.0to^6.6.1
- Updated dependencies:
-
Tests (
test/apollovm_languages_extended_test.dart,test/apollovm_version_test.dart):- Added
library;directive at the top of test files for consistency.
- Added
0.1.0 #
-
WasmRuntime:- Added
WasmModuleFunctiontypedef to represent a WebAssembly-exported function with metadata including the Dart function and avarArgsflag. - Updated
WasmModule.getFunctionsignature to returnWasmModuleFunction<F>?instead of justF?.
- Added
-
WasmRunnerWasm:- Updated function invocation logic in
ApolloRunnerWasmto handleWasmModuleFunctionwithvarArgsflag. - Added special handling for functions with no arguments and functions expecting a single
Listargument.
- Updated function invocation logic in
-
wasm_runtime_generic.dart:- Updated
WasmModuleGeneric.getFunctionto returnnullasWasmModuleFunction<F>?.
- Updated
-
wasm_runtime_io.dart:- Updated
WasmModuleIO.getFunctionto return aWasmModuleFunctionwithvarArgs: true.
- Updated
-
wasm_runtime_dart_html.dart:- Deprecated
WasmRuntimeDartHTMLin favor ofWasmRuntimeWeb. - Updated
WasmModuleBrowser.getFunctionto return aWasmModuleFunctionwithvarArgs: true. - Updated
createWasmRuntimeto returnWasmRuntimeDartHTMLwith deprecation warning.
- Deprecated
-
wasm_runtime_web.dart:- New
WasmRuntimeWebimplementation usingdart:js_interopandwebpackage. - Added JS interop bindings for WebAssembly APIs using extension types.
- Implemented
WasmModuleBrowserwrapping_WasmInstancewith proper JS interop. getFunctionreturns a Dart function wrapping JS function calls with argument conversion andvarArgs: false.- Added utilities to convert JS BigInt to Dart
numorBigInt. - Updated
createWasmRuntimeto returnWasmRuntimeWeb. - Added extensions for JS function invocation and JSAny type checks and casts.
- New
-
pubspec.yaml:- Added dependency on
web: ^1.1.1.
- Added dependency on
-
Tests:
- Added new tests
operation3andoperation4verifying multi-parameter Dart functions compiled to Wasm and executed correctly.
- Added new tests
0.0.54 #
-
Updated minimum Dart SDK constraint to
>=3.10.0 <4.0.0. -
Dependency updates:
swiss_knife: ^3.3.14async_extension: ^1.2.22data_serializer: ^1.2.1petitparser: ^6.1.0collection: ^1.19.1args: ^2.7.0wasm_run: ^0.1.0+2crypto: ^3.0.7path: ^1.9.1test: ^1.31.0
-
Reformatted code for Dart 3.10+
-
lib/src/languages/wasm/wasm_runtime_browser.dart- Suppress deprecated
dart:htmlusage warning with// ignore: deprecated_member_useimport directive
- Suppress deprecated
0.0.53 #
- wasm_run: ^0.1.0+1
0.0.52 #
-
New
ASTExpressionVariableDirectOperation(++and--operators). -
New
StrictTypeinterface forequalsStrictoverASTTypeIntandASTTypeDouble. -
ApolloGeneratorWasm:- Improve auto casting to int32/int64 and float32/float64.
- Implemented
generateASTExpressionVariableDirectOperation.
0.0.51 #
-
sdk: '>=3.3.0 <4.0.0'
-
swiss_knife: ^3.2.0
-
data_serializer: ^1.1.0
-
petitparser: ^6.0.2
-
path: ^1.9.0
-
lints: ^3.0.0
-
dependency_validator: ^3.2.3
-
test: ^1.25.2
-
xml: ^6.5.0
0.0.50 #
WasmRuntime: new VM implementation.wasm_runtime_io.dart:- Dart CI: wasm_run:setup (install dynamic library)
- wasm_run: ^0.0.1+3
0.0.49 #
ASTTypeDouble:acceptsType: now also accepts anASTTypeInt.
wasm_generator.dart:- Fix
isBits64.
- Fix
- Improve Wasm test coverage.
0.0.48 #
-
ASTNode:- Now is a mixin.
getNodeIdentifier: added optional parameterrequester.- Added
childrenanddescendantChildren.
-
ASTFunctionDeclaration:getNodeIdentifier: now can also resolve identifiers inside statements.
-
Wasm:
- Encode function names with UTF-8.
Wasm64: addedi64WrapToi32.
-
WasmContext:- Added
returnsstate.
- Added
-
ApolloGeneratorWasm:- Added
_autoConvertStackTypes. generateASTStatementReturnValueandgenerateASTStatementReturnVariable:- Auto cast returning types.
- Added
-
Dart CI: added job
test_exe.
0.0.47 #
- Improve variable type resolution while compiling to Wasm.
0.0.46 #
- Improve type resolution of
ASTTypeVar. - Optimize some
asyncmethods.
0.0.45 #
-
ASTBranchIfElseBlockandASTBranchIfElseIfsElseBlock:blockElse: optional.
-
ASTParametersDeclaration:- Added
allParameters.
- Added
-
ASTTypeIntandASTTypeDouble:- Added
bits - Added
ASTTypeInt.instance32andASTTypeInt.instance64. - Added
ASTTypeDouble.instance32andASTTypeDouble.instance64.
- Added
-
ASTValueNum:- Added field
negative.
- Added field
-
ApolloGeneratorWasm:- Changed to 64 bits.
Wasm: split inWasm32andWasm64with improved opcodes.- Allow operations with different types (auto casting).
- Handle
unreachableend of function cases. - Implemented:
generateASTValue,generateASTValueDouble,generateASTValueInt.generateASTExpressionVariableAssignment,generateASTStatementExpressiongenerateASTBranchIfBlock,generateASTBranchIfElseBlock,generateASTBranchIfElseIfsElseBlock.generateASTStatementReturnWithExpression,generateASTStatementReturn,generateASTStatementReturnValue.
-
ApolloParserWasm:- Identify if an
ASTTypeIntorASTTypeDoubletype is a32or64bits.
- Identify if an
-
ApolloRunnerWasm:- Use the parsed Wasm functions (AST) to normalize the parameters before calling the Wasm function.
-
WasmModule:- Added
resolveReturnedValue.- Browser implementation: when the function returns a
f64, the JSbigintneeds to be converted to a DartBigInt.
- Browser implementation: when the function returns a
- Added
-
New
WasmModuleExecutionError.
0.0.44 #
pubspec.yaml: update description.
0.0.43 #
ApolloRunner:getFunctionCodeUnit: fix returned codeUnit whenallowClassMethod = true.
0.0.42 #
-
New
SourceCodeUnitandBinaryCodeUnit.CodeUnitnow isabstract:- Renamed field
sourcetocode.
- Renamed field
-
Using
SourceCodeUnitinstead ofCodeUnitwhen necessary. -
ApolloParserrenamed toApolloCodeParser:- Allows binary code parsing (not only strings).
- New
ApolloSourceCodeParser.
-
ApolloRunner:- Added
getFunctionCodeUnit.
- Added
-
Using
Leb128from packagedata_serializer. -
BytesOutputnow extendsBytesEmitter(fromdata_serializer). -
ApolloGeneratorWasm:generateASTExpressionOperation: allow operations with different types (auto casting frominttodouble).
-
New
WasmRuntimeandWasmModule.- Implementation:
WasmRuntimeBrowser.
- Implementation:
-
New
WasmModuleLoadError. -
WasmContext:- Added stack status to help code generation.
-
data_serializer: ^1.0.11
-
wasm_interop: ^2.0.1
-
crypto: ^3.0.3
-
path: ^1.8.3
0.0.42+alpha #
- Renamed
ApolloLanguageRunnertoApolloRunner. - Organize runners implementation files.
0.0.41 #
README.md: added Wasm example.- Minor fixes.
0.0.40 #
-
New
ApolloGeneratorWasm.- Basic support to compile the AST tree to Wasm.
-
New
BytesOutputfor binary code generation. -
data_serializer: ^1.0.10
0.0.39 #
ApolloVMNullPointerExceptionandApolloVMCastExceptionnow extendsApolloVMRuntimeError.- AST implementation:
- Changes some
StateErrorwhile executing toApolloVMRuntimeError.
- Changes some
- New abstract
ApolloCodeUnitStorage:- Implementations:
ApolloSourceCodeStorage,ApolloSourceCodeStorageMemory.ApolloBinaryCodeStorage,ApolloBinaryCodeStorageMemory.ApolloGenericCodeStorageMemory.
- Implementations:
ApolloGeneratornow defines the output type.- New
GeneratedOutput.
0.0.38 #
pubspec.yaml:- Added issue_tracker
- Added topics.
- Added screenshots.
README.md:- Added
Codecovbadge and link.
- Added
0.0.37 #
- Update
pubspec.yamldescription. README.md: added TODO list.
0.0.36 #
ApolloCodeGenerator:generateASTValueStringExpression: try to preserve single quotes in concatenations sequence.
- Java 11:
- Added support for
ArrayListandHashMapliterals.
- Added support for
0.0.35 #
ASTRoot:- Added
getClassWithMethod.
- Added
CodeNamespace:- Added
getCodeUnitWithClassMethod.
- Added
ApolloLanguageRunner:executeFunction: added parameterallowClassMethod.
- Added
ASTExpressionListLiteralandASTExpressionMapLiteral:- Support in
dartandjavagrammar.
- Support in
0.0.34 #
ApolloVM:loadCodeUnitnow throws aSyntaxErrorwith extended details.
ParseResult:- Added fields
codeUnit,errorPositionanderrorLineAndColumn. - Added getters
errorLineanderrorMessageExtended
- Added fields
- Added
ASTExpressionNegation:- Added support for
dartandjava11.
- Added support for
0.0.33 #
ASTNodeimplementations:- Implement
toStringwith a pseudo-code version of the node to facilitate debugging.
- Implement
- Fixed parsing of comments in Dart and Java 11.
0.0.32 #
-
Dart CI: update and optimize jobs.
-
sdk: '>=3.0.0 <4.0.0'
-
swiss_knife: ^3.1.5
-
async_extension: ^1.2.5
-
petitparser: ^6.0.1
-
collection: ^1.18.0
-
args: ^2.4.2
-
lints: ^2.1.1
-
test: ^1.24.6
-
xml: ^6.4.2
-
path: ^1.8.3
0.0.31 #
- Improved GitHub CI:
- Added browser tests.
- Optimize imports.
- Clean code and new lints adjusts.
- sdk: '>=2.15.0 <3.0.0'
- swiss_knife: ^3.1.1
- async_extension: ^1.0.9
- petitparser: ^5.0.0
- collection: ^1.16.0
- args: ^2.3.1
- lints: ^2.0.0
- dependency_validator: ^3.2.2
- test: ^1.21.4
- pubspec: ^2.3.0
- xml: ^6.1.0
- path: ^1.8.2
0.0.30 #
- Using
async_extensionto optimize async calls.- Removed internal extensions with similar functionality.
- Migrated from
pedantictolints. - Fixed missing await in
ASTExpressionVariableAssignment. - lints: ^1.0.1
- swiss_knife: ^3.0.8
- async_extension: ^1.0.6
- petitparser: ^4.2.0
0.0.29 #
- Improve
ApolloVMCore:- Implementing portable
intclass fordartandjava11:parse,parseInt.
- Implementing portable
- Code generation:
- Correctly normalize
intandIntegerfordartandjava11.
- Correctly normalize
- Improve
asyncoptimization.
0.0.28 #
- Implement static class accessor, to allow calls to static functions.
- Initial version of
ApolloVMCore:- Implementing portable
Stringclass fordartandjava11:- Mapping:
contains,toUpperCase,toLowerCase,valueOf.
- Mapping:
- Implementing portable
- Fixed class field code generation for
dartandjava11. asyncoptimization:- Avoid instantiation of
Future, usingFutureOrExtensionandListFutureOrExtension:resolve,resolveMappedandresolveAllMapped.
- Avoid instantiation of
- Improved languages tests, to also executed regenerated code.
0.0.27 #
- Runner:
- Strong types.
vartypes can be resolved.ASTTypedNode: nodes can be typed, and resolution is performed and cached while running.
- Optimize resolution of functions.
- Strong types.
- Grammar:
- Dart & Java:
vartypes to be resolved at runtime.
- Dart & Java:
0.0.26 #
- Generator:
- Dart & Java:
- Improve String concatenation with variables.
- Dart & Java:
0.0.25 #
- Grammar:
- Dart & Java:
- Added
forloop statement:ASTStatementForLoop.
- Added
- Dart & Java:
- Adjust
README.md.
0.0.24 #
ApolloVM:parseLanguageFromFilePathExtension
ApolloLanguageRunner:tryExecuteFunctiontryExecuteClassFunction
- Executable:
apollovm
- args: ^2.0.0
- pubspec: ^2.0.1
- path: ^1.8.0
0.0.23 #
- Improve tests, to tests definitions directory of XML files.
0.0.22 #
caseInsensitiveoption for:- setField, getField, getFunctionWithName, getFunction,getClass
0.0.21 #
- Better handling of function signature and how to pass positional and named parameters.
0.0.20 #
- Added
ASTClass.getFieldsMap. ASTEntryPointBlock.executewith extra parametersclassInstanceObjectandclassInstanceFields.- Change signature of
dartRunner.executeFunctionandjavaRunner.executeClassMethod.- Now they use named parameters for
positionalParametersandnamedParameters.
- Now they use named parameters for
0.0.19 #
- Grammar:
- Java & Dart:
- Parse boolean literal.
- Java & Dart:
- Improve API documentation.
0.0.18 #
- API Documentation.
0.0.17 #
- Fix call of function using
dynamictype in parameter value. - Code Generator:
- Better formatting for classes and methods.
- Grammar:
- Dart:
- Fix parsing of function with multiple parameters.
- Java:
- Class fields.
- Fix parsing of function with multiple parameters.
- Return statements ;
- Dart:
0.0.16 #
- Grammars:
- Dart & Java11:
- Fix parsing of multiple parameters.
- Dart & Java11:
- Runner:
- Fix division with double and int.
- Code Generator:
- Dart & Java11:
- Fix variable assigment duplicated ';'.
- Dart:
- Improve string template regeneration, specially when parsed code comes from Java.
- Dart & Java11:
- Improved example.
0.0.15 #
ASTBlock: addedfunctionsNames.ASTClass: addedfieldsandfieldsNames.ApolloLanguageRunner: addedgetClass.
0.0.14 #
- AST:
ASTClassFunctionDeclaration: To ensure that any class function is parsed from a class block and also ensure that is running from a class block.
- Generator:
- Dart:
- Fix non class function: due static modifier.
- Java:
- Will throw an exception if the generation of a function without a class is attempted.
- Dart:
- Runner:
- Fix class object instance context.
0.0.13 #
- Grammar & Runner:
- Dart & Java:
- Class fields.
- Class object instance fields at runtime.
- Dart & Java:
- Code Generator:
- Dart & Java:
- Fix return statement with value/expression ;
- Java:
- Better/shorter code for String concatenation.
- Dart & Java:
0.0.12 #
- Grammars & Code Generators & Runner:
- Dart & Java11:
- Better definition of static methods.
- Class object instance.
- Dart & Java11:
0.0.11 #
- Renamed:
ASTCodeBlock->ASTBlock.ASTCodeRoot->ASTRoot.ASTCodeClass->ASTClass.
- Added support to
asynccalls inASTNodeexecution.- Any part of an
ASTNodecan have anasyncresolution. This allows the mapping of external functions that returns aFutureor other languages that acceptsasyncat any point.
- Any part of an
- Better mapping of external functions:
- Better Identification of number of parameters of mapped functions.
- Now an
ASTRootor anASTClassare initialized:- Class/Root statements are executed once, and a context for each Class/Root is held during VM execution.
0.0.10 #
- Refactor:
- Split
apollovm_ast.dartinto multipleast/apollovm_ast_*.dartfiles.
- Split
0.0.9 #
- Code Generators:
- Fix
elsebranch indentation.
- Fix
0.0.8 #
- Fix package description.
- Renamed Java8 to Java11:
- Java 11 is closer to Dart 2 than Java 8.
- Grammars & Code Generators:
- Dart & Java11:
- Support
if,else ifandelsebranches.
- Support
- Dart & Java11:
0.0.7 #
- Added type
ASTTypeBooland valueASTValueBool. - Added
ApolloVMNullPointerException. - Grammars & Code Generators:
- Dart & Java8:
- Support to expression comparison operators
==,!=,>,<,>=,<=.
- Support to expression comparison operators
- Dart & Java8:
- Upgrade: petitparser: ^4.1.0
0.0.6 #
- Grammars:
- Dart:
- Added support for string templates:
- including variable access:
$x. - including expressions:
${ x * 2 }. - Not implemented for multiline string yet.
- including variable access:
- Added support for string templates:
- Java8:
- Support for string concatenation.
- Dart:
- Code Generators:
- Java8:
- Translate string templates to Java String concatenations.
- Java8:
0.0.5 #
- Grammars:
- Dart:
- Raw single line and raw multiline line strings.
- Improved parser tests for literal String.
- Dart:
0.0.4 #
- Added type check:
ASTType.isInstance.- Function call now checks type signature and type inheritance.
- Grammars:
- Dart:
- Single line and multiline line strings with escaped chars.
- Java8:
- Single line strings with escaped chars.
- Dart:
0.0.3 #
- Removed
ASTCodeGenerator, that is language specific now:ApolloCodeGenerator. - Better external function mapping.
- Grammars:
- Dart:
- Expression operations:
+,-,*,/,~/.
- Expression operations:
- Java8:
- Expression operations:
+,-,*,/.
- Expression operations:
- Dart:
- Improved tests.
0.0.2 #
- Improved execution:
- Now can call a class method or a function.
- Improved code generation:
- Now supporting Java8 and Dart.
- Grammars:
- Dart:
- Basic class definition.
- Java8:
- Basic class definition.
- Dart:
0.0.1 #
- Basic Dart and Java8 support.
- Initial version, created by Stagehand
