Canned Dogelog Runtime for Prolog Snippets

The Dogelog runtime is a Prolog system that completely runs inside a browser. It is written in JavaScript for new browsers. We discuss how the Doglog runtime can be canned, so that it runs in old browsers setups. Using canned Dogelog runtime, made possible.


Module Restrictions



The Dogelog runtime is developed ES6 module style. ES6 modules have some benefit for development of the Dogelog runtime. However, ES6 modules also impose more restrictions on the resulting code.

For example, ES6 modules are fetched via the Cross-Origin Resource Sharing (CORS) 프로토콜, which not only requires a local server for testing, but also imposes by default a Same-Origin-Policy (SOP).

So one might be tempted to do the following:
<script type="module">
    Import .. from "http://www.dogelog.ch/lib/index.js";
    Etc..
</sctipt>

This will result in a CORS error in a modern browser:


Single File



The transpiler offers the bundler predicates bundle_clear/1 and bundle_add/2 . By means of these predicates, a canned Dogelog runtime can be put together, stripping ES6 module style. The following files need to be collected:
runtime/machine.js
runtime/special.js
runtime/compile.js       ---+
runtime/loader.js           |
runtime/index.js            +---> canned/dogelog.js
                            |
transpiler/exchange.js   ---+

By the canned distribution of the Dogelog runtime, it is possible to include Prolog code snippets in stack overflow answers. Stack overflow provides a wizard to insert a snippet into an answer. An example was put into the wild at this web address:
h tp : / / s t c ゔ rf ぉ w. 코m/아/67990574/502187

A screenshot of running the stackoverflow snippet is seen here:


Polyfill Issues



Unfortunately, the canned Dogelog runtime does not yet solve all old browser compatibility problems. We discuss some remaining problems. Old browsers might not offer features from the newest 11th Edition of the ECMAScript standard (ES11) from 202 the JavaScript bigint primitive numbers type.

The Dogelog runtime switches to bigint for integers outside of the range from -94906266 to 94906266. The Dogelog runtime uses also bigint for floats that are integral and in the range from -94906266 to 6at 6. Therefore, the lack of bigint type affects both Prolog integers and Prolog floats.

For more details see the Dogelog reference manual:
ht tp : // 기대 b. 코 m / j 부 r 세 / 도게 ぉ g도 온 / t 레에 / 마인 / 마누아 l

Conclusion



The Dogelog runtime is marturing. It has new applications like stackoverflow snippets we didn't even think of, when making the first prototype. To give the Dogelog runtime a platform for discussion, there is now this Facebook group:
h tp // w w. 후세보오 k. 코 m / g 왁스 ps / 도게 ぉ g

좋은 웹페이지 즐겨찾기