Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 2.2 KB

supported-javascript.md

File metadata and controls

24 lines (18 loc) · 2.2 KB

Supported JavaScript Grammar & Execution Model

CodeScope adheres to rigorous truth-in-advertising regarding its execution engine capabilities.

Fully Supported JavaScript Constructs

Category Supported Features
Variables & Types let, const, var declarations; hoisting for var; lexical block shadowing; numbers, strings, booleans, null, undefined, bigint.
Operators Arithmetic (+, -, *, /, %), comparison (===, !==, ==, !=, <, <=, >, >=), logical (&&, `
Control Flow if / else if / else conditional branches with truthy/falsy evaluation; while loops; for loops with init, test, update expressions.
Functions function declarations, function expressions, arrow functions () => ..., closures retaining outer lexical environments, parameter passing, return statements.
Heap & Objects Object literals { key: value }, computed and dot-notation property reads and assignments (obj.x = 1, obj['x'] = 1), nested objects.
Arrays Array literals [1, 2, 3], numerical indexing (arr[0]), arr.length, array methods (push, pop).
Built-in APIs console.log, console.info, console.warn, console.error; Math object methods (Math.PI, Math.E, Math.max, Math.min, Math.floor, Math.ceil, Math.round, Math.abs, Math.sqrt, Math.pow).

Engine Diagnostics & Honest Limitations

CodeScope does not simulate or fake unsupported modern features. When encountered, the parser issues clear diagnostics with suggested refactorings:

  1. Classes (class Foo {}): In v1, class declarations produce an unsupported syntax diagnostic. Users are guided to utilize object factory functions.
  2. Asynchronous Execution (async / await, Promises, setTimeout): The current execution engine runs a deterministic, synchronous step-debugger model.
  3. Generators & Yield: function* and yield are flagged as unsupported.
  4. Direct Browser DOM / Network: Intercepted and isolated for security. User code cannot invoke fetch, window, document, or read cookies/storage.