WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine. Wasm is designed as a portable compilation target for programming languages, enabling deployment on the web for client and server applications. See the WebAssembly website for more information.
Free Pascal and WebAssembly
FPC supports two Wasm compilation targets: WASI and embedded. See WebAssembly/Compiler on how to build and install FPC for Wasm.
WASI - the WebAssembly System Interface - defines an API for operating system-like features, including files and filesystems, network sockets, clocks and random numbers. These features, when implemented in web browsers as well as standalone Wasm runtimes on desktops, servers, and serverless cloud computing units, are available to Pascal programs and libraries compiled by FPC to Wasm for the WASI target.
The FPC WASI RTL consists of these units:
The FPC Wasm embedded RTL consists of these units:
With respect to the embedded target, there are presently (2022) early efforts to create Wasm-related standards for cross-device/platform/architecture embedded applications.
Overall, FPC's Wasm support adds to FPC's already extensive list of compilation targets, potentially allowing Pascal programs to run in even more environments than they already do.
Running in Web Browsers
With Standalone Runtime
There is an external pet project to create a pascal interpreter, not related to Free Pascal: