zqjs is a JavaScript engine implemented in ABAP and derived architecturally from QuickJS.
The current implementation contains a growing embedded-language profile:
- tagged primitive values with explicit NaN, positive/negative infinity, and negative zero;
- UTF-16 string abstraction, bounded atom table, all completion kinds, runtime/context ownership, and enforced instruction/source/parser/bytecode/stack limits;
- explicit numeric coercion plus interim decimal/hex/octal/binary literal parsing;
- locale-independent shortest-round-trip formatting for finite Numbers with ECMAScript decimal/exponent shaping;
- lexer and direct bytecode emitter for primitive literals, arithmetic, comparison,
equality, logical and bitwise operators, variables, blocks,
if/else,while, C-stylefor,break, andcontinue; - hoisted named functions, parameters, calls, returns, recursion, and mutable lexical closures;
- ordinary and async arrow functions with concise/block bodies, default/rest parameters,
non-constructibility, and lexical
this/argumentscapture; - 108 verified QuickJS-aligned opcode IDs, constant/local slots, patched jumps, a disassembler, and an iterative VM with explicit frames;
- shape-backed ordinary objects, data and accessor property descriptors,
prototypes, constructors,
this,instanceof, object/array literals, computed properties, anddelete; - string concatenation/comparison, thrown-value propagation, and nested
try/catchacross function frames; - block-scoped
let/const, TDZ and const-assignment errors, plusfinallyhandling for normal and abrupt completions; - abstract equality, logical short-circuiting, remainder, unary logical negation,
comments, and line-terminator-sensitive
return/throwhandling; - ordinary arrays with indexed reads/writes, sparse growth, and
length; - String primitive and wrapper indexing plus foundational
String.prototypesearch, extraction, concatenation, repeat, case-conversion, and trim methods; - initial intrinsics for
Object,Array,Number,String,Boolean,Math,JSON,isNaN,NaN, andInfinity, includingObjectreflection methods, strict JSON parsing/stringification, the coreErrorconstructors includingEvalErrorand standardoptions.causeproperties, andArray.isArray; - persistent contexts, direct calls, host-callable and host-constructable interfaces, catchable host-error translation, runtime disposal, resource budgets, and cooperative cancellation, including runtime-owned disposable host resources and a Promise rejection-tracking callback for embedding hosts;
- a
globalThisobject whose data properties share storage with script and host global bindings, with top-level scriptthisand lexical-global separation; - public
zcl_qjs=>eval( )facade and explicit runtime/context embedding API; - an initial bounded Promise job queue with
Promiseconstruction,resolve,reject,then, genericcatch/finally, ordered checkpoint draining, promise adoption, and deferred foreign-thenable assimilation, plus iterablePromise.all,allSettled,any, andrace, constructor-sensitive capability creation, custom species chaining, native Promise subclass construction, host rejection tracking, andAggregateErrorrejection forPromise.any; - initial async function declarations, expressions, class methods, and object methods
with immediate body execution, Promise-backed completion,
awaitsuspension/resumption, rejection injection, and ordered continuation jobs, plusfor await..ofover asynchronous and synchronous iterables with awaited closure; - async generator declarations, expressions, and class/object methods with lazy
execution, FIFO
.next()/.throw()/.return()requests, awaited yields and returns, rejection injection, call-time parameter initialization, the asynchronous-iterator prototype chain, and delegatedyield*over async or synchronous iterators; - ABAP Unit tests executed through the abaplint transpiler on Node.
For example, this source is tokenized, compiled, and interpreted rather than delegated to the host JavaScript engine:
DATA(result) = zcl_qjs=>eval( `1 + 2 * 3` ).
DATA(number) = zcl_qjs_value=>as_finite_number( result ).Prerequisites are Node.js 22.18 or newer and Git. Dependencies and upstream source pins
are exact and recorded in package-lock.json and upstream-lock.json. The full test
suite also builds the pinned QuickJS compiler oracle and therefore requires make and
a C compiler. On Windows, use an MSYS2 MinGW64 toolchain; Git Bash alone does not
include those build tools.
npm ci
npm test
For local development without a native QuickJS build toolchain, run the same suite without rebuilding and checking the committed compiler-oracle fixture:
npm run test:without-oracle
npm test verifies the pinned QuickJS opcode metadata and normalized compiler-oracle
fixture, validates the machine-readable compatibility profile against the lockfiles and
published conformance denominator, runs abaplint, transpiles the ABAP, executes the ABAP Unit suite with
node --expose-gc, self-tests the test262 metadata parser, and then runs 980 pinned
test262 language and built-in cases through the transpiled zqjs engine. Positive and negative
tests, feature exclusions, harness includes, persistent-context $DONE async tests, and
pass/fail/unsupported/infrastructure skip outcomes are handled explicitly. Set
TEST262_FILTER to a path substring for a focused development run.
See compatibility-profile.json for the enforced profile, PROFILE.md for its human-readable detail, and PLAN.md for the remaining implementation phases.