Psychoscript language and library map

Every syntax node, global, built-in member and exclusion in Psychoscript v0.13.0 (5428a8ae), beside tinyscript's current status. Skip psychoscript.com's satirical matrix, which lags behind the repository.

Back to the comparisonPsychoscript's checklist

Built-ins beside tinyscript

Psychoscript exposes 52 globals in TypeScript and 11 more typed arrays in Rust. Across 34 built-ins and intrinsic prototypes, it defines 20 constants, 129 statics, 44 accessors and 368 prototype methods.

Built-intinyscriptConstants and staticsAccessors and prototype
Objectpartialassign, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyDescriptors, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, groupBy, hasOwn, is, isExtensible, isFrozen, isSealed, keys, preventExtensions, seal, valueshasOwnProperty, isPrototypeOf, propertyIsEnumerable, toLocaleString, toString, valueOf
Functionpartial—arguments, caller, apply, bind, call, toString
Arraypartialfrom, fromAsync, isArray, ofat, concat, copyWithin, entries, every, fill, filter, find, findIndex, findLast, findLastIndex, flat, flatMap, forEach, includes, indexOf, join, keys, lastIndexOf, map, pop, push, reduce, reduceRight, reverse, shift, slice, some, sort, splice, toLocaleString, toReversed, toSorted, toSpliced, toString, unshift, values, with
StringpartialfromCharCode, fromCodePoint, rawat, charAt, charCodeAt, codePointAt, concat, endsWith, includes, indexOf, isWellFormed, lastIndexOf, localeCompare, match, matchAll, normalize, padEnd, padStart, repeat, replace, replaceAll, search, slice, split, startsWith, substr, substring, toLocaleLowerCase, toLocaleUpperCase, toLowerCase, toString, toUpperCase, toWellFormed, trim, trimEnd, trimLeft, trimRight, trimStart, valueOf
NumberpartialEPSILON, MAX_SAFE_INTEGER, MAX_VALUE, MIN_SAFE_INTEGER, MIN_VALUE, NEGATIVE_INFINITY, NaN, POSITIVE_INFINITY, isFinite, isInteger, isNaN, isSafeInteger, parseFloat, parseInttoExponential, toFixed, toLocaleString, toPrecision, toString, valueOf
BigIntpartialasIntN, asUintNtoLocaleString, toString, valueOf
Booleanimplemented—toString, valueOf
SymbolpartialasyncIterator, iterator, toPrimitive, toStringTagdescription, toString, valueOf
MathpartialE, LN10, LN2, LOG10E, LOG2E, PI, SQRT1_2, SQRT2, abs, acos, acosh, asin, asinh, atan, atan2, atanh, cbrt, ceil, clz32, cos, cosh, exp, expm1, f16round, floor, fround, hypot, imul, log, log10, log1p, log2, max, min, pow, random, round, sign, sin, sinh, sqrt, sumPrecise, tan, tanh, trunc—
JSONpartialparse, stringify—
DatepartialUTC, now, parsegetDate, getDay, getFullYear, getHours, getMilliseconds, getMinutes, getMonth, getSeconds, getTime, getTimezoneOffset, getUTCDate, getUTCDay, getUTCFullYear, getUTCHours, getUTCMilliseconds, getUTCMinutes, getUTCMonth, getUTCSeconds, setDate, setFullYear, setHours, setMilliseconds, setMinutes, setMonth, setSeconds, setTime, setUTCDate, setUTCFullYear, setUTCHours, setUTCMilliseconds, setUTCMinutes, setUTCMonth, setUTCSeconds, toDateString, toGMTString, toISOString, toJSON, toLocaleDateString, toLocaleString, toLocaleTimeString, toString, toTimeString, toUTCString, valueOf
RegExppartialescapedotAll, flags, global, hasIndices, ignoreCase, lastIndex, multiline, source, sticky, unicode, unicodeSets, exec, test, toString
MappartialgroupBysize, clear, delete, entries, forEach, get, getOrInsert, getOrInsertComputed, has, keys, set, values
Setpartial—size, add, clear, delete, difference, entries, forEach, has, intersection, isDisjointFrom, isSubsetOf, isSupersetOf, keys, symmetricDifference, union, values
WeakMappartial—delete, get, getOrInsert, getOrInsertComputed, has, set
WeakSetpartial—add, delete, has
Promisepartialall, allSettled, any, race, reject, resolve, try, withResolverscatch, finally, then
Iteratorpartialfromdrop, every, filter, find, flatMap, forEach, map, next, reduce, some, take, toArray
Generatorplanned—next, return, throw
AsyncGeneratorpartial—next, return, throw
IteratorHelpernot in spec—next, return
AsyncFromSyncIteratornot in spec—next, return, throw
ErrorpartialisErrortoString
ArrayBufferplannedisViewbyteLength, detached, maxByteLength, resizable, slice
DataViewplanned—buffer, byteLength, byteOffset, getBigInt64, getBigUint64, getFloat16, getFloat32, getFloat64, getInt16, getInt32, getInt8, getUint16, getUint32, getUint8, setBigInt64, setBigUint64, setFloat16, setFloat32, setFloat64, setInt16, setInt32, setInt8, setUint16, setUint32, setUint8
Uint8Arraypartialfrom, fromBase64, fromHex, ofbuffer, byteLength, byteOffset, length, at, copyWithin, entries, every, fill, filter, find, findIndex, findLast, findLastIndex, forEach, includes, indexOf, join, keys, lastIndexOf, map, reduce, reduceRight, reverse, set, setFromBase64, setFromHex, slice, some, sort, subarray, toBase64, toHex, toReversed, toSorted, toString, values, with
Buffernot in specalloc, allocUnsafe, allocUnsafeSlow, byteLength, compare, concat, copyBytesFrom, from, isBuffer, isEncoding, of, poolSizecompare, copy, equals, fill, includes, indexOf, lastIndexOf, readBigInt64BE, readBigInt64LE, readBigUInt64BE, readBigUInt64LE, readBigUint64BE, readBigUint64LE, readDoubleBE, readDoubleLE, readFloatBE, readFloatLE, readInt16BE, readInt16LE, readInt32BE, readInt32LE, readInt8, readIntBE, readIntLE, readUInt16BE, readUInt16LE, readUInt32BE, readUInt32LE, readUInt8, readUIntBE, readUIntLE, readUint16BE, readUint16LE, readUint32BE, readUint32LE, readUint8, readUintBE, readUintLE, slice, subarray, swap16, swap32, swap64, toJSON, toString, write, writeBigInt64BE, writeBigInt64LE, writeBigUInt64BE, writeBigUInt64LE, writeBigUint64BE, writeBigUint64LE, writeDoubleBE, writeDoubleLE, writeFloatBE, writeFloatLE, writeInt16BE, writeInt16LE, writeInt32BE, writeInt32LE, writeInt8, writeIntBE, writeIntLE, writeUInt16BE, writeUInt16LE, writeUInt32BE, writeUInt32LE, writeUInt8, writeUIntBE, writeUIntLE, writeUint16BE, writeUint16LE, writeUint32BE, writeUint32LE, writeUint8, writeUintBE, writeUintLE
URLplannedcanParse, parsehash, host, hostname, href, origin, password, pathname, port, protocol, search, searchParams, username, toJSON, toString
URLSearchParamsplanned—size, append, delete, entries, forEach, get, getAll, has, keys, set, sort, toString, values
Headersplanned—append, delete, entries, forEach, get, getSetCookie, has, keys, set, values
TextEncoderimplemented—encoding, encode, encodeInto
TextDecoderpartial—encoding, fatal, ignoreBOM, decode
cryptonot in specgetRandomValues, randomUUID—
consolepartialassert, count, countReset, debug, dir, error, group, groupCollapsed, groupEnd, info, log, table, time, timeEnd, timeLog, trace, warn—
Psychoscript v0.13.0 (5428a8ae) built-in APIs beside tinyscript commit e0af6be6. 50 methods come from src/prelude/source.ts.
  • Standalone globals (15)require, undefined, NaN, Infinity, parseInt, parseFloat, isFinite, isNaN, encodeURI, encodeURIComponent, decodeURI, decodeURIComponent, atob, btoa, structuredClone (from src/runtime/globals.ts; Buffer is exposed only when the host provides it).
  • Error types (8)Error, TypeError, RangeError, SyntaxError, ReferenceError, EvalError, URIError, AggregateError (from src/runtime/intrinsics.ts).
  • Rust-only typed arrays (11)Uint16Array, Uint32Array, Int32Array, Float32Array, Float64Array, Int8Array, Uint8ClampedArray, Int16Array, Float16Array, BigInt64Array, BigUint64Array (from rust/crates/psychoscript/src/host.rs; absent in the TypeScript VM).
  • In tinyscript's spec, absent in Psychoscript (24)AbortController, AbortSignal, AbstractModuleSource, AsyncDisposableStack, Atomics, DOMException, DisposableStack, FinalizationRegistry, InternalError, Intl, Proxy, Reflect, Request, Response, SharedArrayBuffer, SuppressedError, Temporal, TypedArray, WeakRef, WebAssembly, escape, eval, globalThis, unescape. See Built-in objects and Web platform APIs for tinyscript's current status on each.

Syntax Psychoscript compiles

Psychoscript compiles 20 statement nodes, 24 expression nodes and 5 pattern nodes in src/compiler/compile.ts. It rejects with, debugger, export, new.target, import.meta, private members (#x), static blocks, decorators and TypeScript syntax.

CategoryCountAST nodes
Statements20BlockStatement, BreakStatement, ClassDeclaration, ContinueStatement, DoWhileStatement, EmptyStatement, ExpressionStatement, ForInStatement, ForOfStatement, ForStatement, FunctionDeclaration, IfStatement, ImportDeclaration, LabeledStatement, ReturnStatement, SwitchStatement, ThrowStatement, TryStatement, VariableDeclaration, WhileStatement
Expressions24ArrayExpression, ArrowFunctionExpression, AssignmentExpression, AwaitExpression, BinaryExpression, CallExpression, ChainExpression, ClassExpression, ConditionalExpression, FunctionExpression, Identifier, ImportExpression, Literal, LogicalExpression, MemberExpression, NewExpression, ObjectExpression, SequenceExpression, TaggedTemplateExpression, TemplateLiteral, ThisExpression, UnaryExpression, UpdateExpression, YieldExpression
Patterns5ArrayPattern, AssignmentPattern, Identifier, MemberExpression, ObjectPattern
ESTree node dispatch tables in src/compiler/compile.ts.

Test262 exclusions and boundaries

Psychoscript filters test262 (revision 250f204f) with manifest.json and skips 2670 files in skipped.txt. It excludes 3 flags, 12 regex boundaries and 76 feature flags.

BoundaryPattern
$262 host API\$262
Reflect and Proxy\b(Reflect|Proxy)\b
Symbol\bSymbol\b(?!\.(iterator|asyncIterator)\b)
boxed primitives\b(new\s+(String|Number|Boolean)\b|Object\s*\(\s*(true|false|-?\d|['"]))
eval\b(eval|Function)\b
globalThis\bglobalThis\b
legacy accessors\b__(define|lookup)(Getter|Setter)__\b
new.target\bnew\.target\b
prototype mutationObject\.setPrototypeOf\b
sloppy mode\bwith\s*\(
typed arrays and buffers\b(SharedArrayBuffer|Int8Array|Uint8ClampedArray|Int16Array|Uint16Array|Int32Array|Uint32Array|Float16Array|Float32Array|Float64Array|BigInt64Array|BigUint64Array)\b
weak collections\b(WeakRef|FinalizationRegistry)\b
Regex boundaries excluded in test/test262/manifest.json.
  • Excluded flags (3)module, raw, noStrict.
  • Excluded test262 features (76)Proxy, proxy-missing-checks, Reflect, Reflect.construct, Reflect.set, Reflect.setPrototypeOf, Symbol, Symbol.hasInstance, Symbol.isConcatSpreadable, Symbol.match, Symbol.matchAll, Symbol.prototype.description, Symbol.replace, Symbol.search, Symbol.species, Symbol.split, Symbol.toPrimitive, Symbol.toStringTag, Symbol.unscopables, symbols-as-weakmap-keys, class-fields-private, class-fields-private-in, class-methods-private, class-static-block, class-static-fields-private, class-static-methods-private, new.target, decorators, TypedArray, TypedArray.prototype.at, SharedArrayBuffer, Atomics, Atomics.pause, Atomics.waitAsync, resizable-arraybuffer, arraybuffer-transfer, immutable-arraybuffer, Float16Array, Float32Array, Float64Array, Int8Array, Int16Array, Int32Array, Uint8Array, Uint8ClampedArray, Uint16Array, Uint32Array, uint8array-base64, WeakRef, FinalizationRegistry, Intl-enumeration, Temporal, ShadowRealm, cross-realm, dynamic-import, import.meta, import-attributes, import-defer, export-defer, source-phase-imports, source-phase-imports-module-source, import-text, import-bytes, json-modules, top-level-await, explicit-resource-management, tail-call-optimization, caller, IsHTMLDDA, host-gc-required, legacy-regexp, __proto__, __getter__, __setter__, iterator-sequencing, joint-iteration.

Open items in Psychoscript's checklist

Psychoscript's interpreter-support.md tracks 281 supported items and 19 open gaps across 23 sections.

  • Values and literals (10 done, 3 open)Arbitrary Symbol primitive values and symbol-keyed properties. Four well-known symbols exist: `Symbol.iterator` and `Symbol.asyncIterator` for the iterator protocols, `Symbol.toPrimitive` (consulted by every ToPrimitive that runs program code, before `valueOf`/`toString`), and `Symbol.toStringTag` (read by `Object.prototype.toString`). They have `description` (`"Symbol.iterator"`), `toString` (`"Symbol(Symbol.iterator)"`), `valueOf`, and `Symbol.prototype`. `__defineGetter__` and friends. Built-ins that read program getters ahead (`Array.from` on an array-like, `apply`, `structuredClone`, `String.raw`, `Buffer.from`, `TextDecoder` options, `Headers`/`URLSearchParams` records, `new Error`'s `cause`, `defineProperties`, host arguments) call each getter once per receiver and key per call, in rounds: a value reached twice in one call reuses the first read, and the order across rounds can differ from JS's interleaving. `Array.from` on an iterable reads a `[Symbol.iterator]` getter twice.
  • Statements and control flow (12 done, 1 open)`for...in` skipping keys deleted during the loop.
  • Functions and callbacks (31 done, 3 open)Array methods on `arguments` and other array-likes (`Array.prototype.slice.call(arguments, 1)`); use `[...arguments]` or a rest parameter meanwhile. Private members (`#x`) and static blocks: both are syntax errors with a hint. `new` on plain functions: only classes (and host functions marked `constructible`) can be constructed.
  • Expressions and operators (19 done, 2 open)Coercing a function, promise, generator, or host reference itself: `fn + ""`, `-fn`, `fn++`, and `fn == 1` throw `TypeError: Binary operators require data values.` (or the unary/update form) where JavaScript would use the source text or `NaN`. ToPrimitive elsewhere: `Error.prototype.toString` on an object `message` and numeric arguments of the Array and Uint8Array methods (`at`, `indexOf` start, `slice`) still use the built-in form (`NaN`, `"[object Object]"`) and ignore own methods.
  • Objects and properties (16 done, 1 open)Array elements share one set of attributes, so `defineProperty` on an index takes only the array's own attributes (new elements must say `writable`, `enumerable` and `configurable` true), never an accessor, and an array's `length` can't be made read-only on its own (use `Object.freeze`).
  • BigInt (4 done, 1 open)Boxed BigInts (`Object(1n)`) and `BigInt64Array`/`BigUint64Array`.
  • Iterator (4 done, 1 open)`Iterator.concat`, `Iterator.zip`, and `Iterator.zipKeyed` (stage 3 proposals).
  • ArrayBuffer, DataView and Uint8Array (10 done, 2 open)Resizable buffers (`maxByteLength` in the options is a `TypeError`), `resize`, `transfer` and `transferToFixedLength` (no buffer is ever detached), `SharedArrayBuffer`, and `Atomics`. The other typed arrays.
  • Web platform helpers (8 done, 2 open)`Request`, `Response`, and `Blob`. `crypto.subtle` and non-UTF-8 `TextDecoder` encodings.
  • Host functions (8 done, 2 open)Program functions as arguments to host code (callbacks such as `forEach`). Host classes. Stateful host objects are expressed as closures; a declared method table would be the next step if `new X()` in a program is ever needed.
  • Errors and diagnostics (14 done, 1 open)`Error.captureStackTrace`, `Error.stackTraceLimit`, and async frames through `then` handlers and combinators (V8's `at async Promise.all (index 0)`).

Back to the comparisonRead interpreter-support.md