With respect to the early discussion topic [1] of the “data and evaluation model for the code repository (Wikilambda)”, I would like to broach, for discussion, that the V8 engine [9] and/or WebAssembly [10] can be of use for the Wikilambda project.
While reading the plan [2] and tasks [3] documents, I observed tasks: P1.12 [4], P1.15 [5], O6 [6], O16 [7] and O29 [8]. Task P1.12 [4] indicates JavaScript-based implementations. Task P1.15 [5] indicates Lua implementations. Lua can be compiled to WebAssembly [12]. Task O6 [6] indicates Python implementations. Python can be compiled to WebAssembly [13]. There is a lengthy list of programming languages which already can or are planned to soon be able to compile to WebAssembly [11]. Task O29 [8] indicates compilation for significant speedup.
The use of WebAssembly would facilitate task O16 [7], browser-based evaluation scenarios. WebAssembly is broadly supported by Web browsers.
The V8 engine is utilized by Chromium-based Web browsers such as Brave, Chrome, Edge, Opera, and Vivaldi [9]. “The V8 engine can be used in a browser or integrated into independent projects” [9]. The V8 engine is utilized by the popular Node.js runtime environment [9]. The V8 engine includes a WebAssembly implementation.
With respect to processing JavaScript, the V8 engine “first generates an abstract syntax tree with its own parser. Then, Ignition, the V8 interpreter, generates bytecode from this syntax tree using the internal V8 bytecode format [15]. TurboFan is the V8 optimizing compiler, it takes this bytecode and generates machine code from it. In other words, V8 compiles JavaScript directly to native machine code using just-in-time compilation before executing it. The compiled code is additionally optimized (and re-optimized) dynamically at runtime, based on heuristics of the code's execution profile. Optimization techniques used include inlining, elision of expensive runtime properties, and inline caching” [9]. The V8 engine “can compile to x86, ARM or MIPS instruction set architectures in both their 32- and 64-bit editions; as well, it has been ported to PowerPC and IBM s390 for use in servers” [9].
The V8 engine’s Ignition virtual machine [14] is “a register machine with an accumulator register” [15].
The WebAssembly virtual machine is “a portable virtual stack machine” [10].
In what ways can the V8 engine and/or WebAssembly be of use for the Wikilambda project? Could the V8 engine’s Ignition virtual machine [14][15] and/or the WebAssembly virtual machine [10] be of use as evaluation models or compilation targets for Wikilambda?
Best regards,
Adam Sobieski
[1] https://meta.wikimedia.org/wiki/Abstract_Wikipedia/Early_discussion_topics
[2] https://meta.wikimedia.org/wiki/Abstract_Wikipedia/Plan
[3] https://meta.wikimedia.org/wiki/Abstract_Wikipedia/Tasks
[5] https://meta.wikimedia.org/wiki/Abstract_Wikipedia/Tasks#Task_P1.15:_Lua-based_implementations
[6] https://meta.wikimedia.org/wiki/Abstract_Wikipedia/Plan#Task_O6:_Python-based_implementations
[7] https://meta.wikimedia.org/wiki/Abstract_Wikipedia/Plan#Task_O16:_Browser-based_evaluator
[8] https://meta.wikimedia.org/wiki/Abstract_Wikipedia/Tasks#Task_O29:_Implementation_compilation
[9] https://en.wikipedia.org/wiki/V8_(JavaScript_engine)
[10] https://en.wikipedia.org/wiki/WebAssembly
[11] https://github.com/appcypher/awesome-wasm-langs
[12] https://github.com/appcypher/awesome-wasm-langs#lua
[13] https://github.com/appcypher/awesome-wasm-langs#python
[14] https://v8.dev/docs/ignition
[15]
https://medium.com/dailyjs/understanding-v8s-bytecode-317d46c94775