Skip to main content

Module javascript

Module javascript 

Source
Expand description

JavaScript frontend for the portable core.

It reads the subset of modern JavaScript the core can represent faithfully: Number and BigInt arithmetic, strings and booleans; top-level functions and object-literal namespaces of methods whose types come from JSDoc (@param, @returns, and @typedef unions of { $: 'tag', … } object types for data types) or, where JSDoc is silent, are inferred from how the program uses them; bodies made of const, if, return, throw and switch statements; and a top level of console.log, const and node:assert statements, which are the program’s effects. A function whose leading statements throw on a negative argument takes a natural number. Everything else is rejected with a precise obligation.

Mirrors js/src/translation/javascript.js.

Functions§

parse_javascript
Reads a JavaScript ES module into the surface AST.