Section "javascript"

The specifics mainly deal with the number blending that is applied in the Dogelog Player for the JavaScript platform. Whereas Prolog atoms are simply mapped to JavaScript strings, the map-ping of Prolog numbers is towards JavaScript Number primitive and JavaScript BigInt primitive. The range swap allows separating Prolog floats from Prolog integers.

The following mapping from Prolog to JavaScript is used:

Prolog Atomic
+--- Prolog Atom
+--- JavaScript string
+--- Prolog Number
+--- Prolog integer
+---- JavaScript number in -94906266..94906266
+---- JavaScript bigint otherwise
+--- Prolog float
+---- JavaScript bigint in -94906266..94906266
+---- JavaScript number otherwise
+--- Prolog 0rInf special
+---- JavaScript Infinity
+--- Prolog -0rInf special
+---- JavaScript -Infinity
+--- Prolog 0rNaN special
+---- JavaScript NaN
+--- Prolog 0rNone Reference
+--- JavaScript null
+--- Prolog 0rFalse Reference
+--- JavaScript false
+--- Prolog 0rTrue Reference
+--- JavaScript true
The following JavaScript specific calls are provided:
is_bigint(T): host language
Check whether the object T is a JavaScript bigint.
norm_smallint(T): host language
Return the JavaScript smallint T normalized to a Prolog integer.
norm_bigint(T): host language
Return the JavaScript bigint T normalized to a Prolog integer.
widen_bigint(T): host language
Return the Prolog integer T widened to a JavaScript bigint.
char_count(C): host language
Return the 16-bit char count of a Unicode code point C.

Use Privacy (c) 2005-2026 XLOG Technologies AG