Did you know ... | Search Documentation: |
Translating Prolog data to JavaScript |
Most of the translation from Prolog data to JavaScript is the reverse
of the translation described in section
13.2.2.1. In some cases however reverse translation is ambiguous.
For example, both
42
and 42n
(a JavaScript BigInt
)
translate to a simple Prolog integer. The other way around, as
JavaScript
Number
is a float, both Prolog 42
and 42.0
translate to 42
in JavaScript.
Prolog.Variable
instance where
the identifier is a unique number of each unique variable.Number
when possible or
BigInt
otherwise. Currently JavaScript Number
can represent integers upto 2^53 precisely.Prolog.Rational
instance.Number
.String
.Prolog.String
instance.Array
,
otherwise create a JavaScript Prolog.List
instance.Prolog.Compound
instance.Object
with the same keys. If the
dict has a non-var tag, add a $tag
property.