Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2023-10

Running FPC in the browser...

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt

Hello,

Thanks to the efforts of Nikolay Nikolov, the FPC compiler can now recompile itself to webassembly (the support for the goto statement made this possible).

As a consequence, this means FPC can now be run in a browser. See the screenshot at

https://wiki.freepascal.org/WebAssembly#Running_in_Web_Browsers

There are still some steps to do before FPC will actually compile and link a program, but this is in the works as well.

If you think this is just a cute geeky achievement, it is not.

Think about the possibilities: being able to work without the need for an installation. Just go to a webpage and start developing as you would on your desktop.

For teaching programming, a teacher does not need to provide anything except a browser and still have all the possibilities he would have when using a desktop.
No heavy server infrastructure is needed, everything happens in the browser.

No doubt, other possibilities will come to mind.

Stay tuned for more goodies from the FPC team :-)

Michael.

Reply by email

Wayne Sherman
to Michael Van Canneyt
Thanks to the efforts of Nikolay Nikolov, the FPC compiler can now recompile itself to webassembly

I just watched an interesting talk from StrangeLoop called:

"Inside the Wizard Research Engine" by Ben L. Titzer https://www.youtube.com/watch?v=43ENxjq2Vhc

The Wizard Research Engine is a WASM interpreter for research and analysis that can help compiler and program writers analyze and debug their code. It can be used to perform WASM code coverage, branch profiling, memory/cache profiling, dynamic call graph construction, debug breakpoints, watchpoint, tracing and fuzzing and fault injection. (see talk @ 11:14 and 13:54)

Wizard: An advanced WebAssembly Engine for Research https://github.com/titzer/wizard-engine

Reply by email

Michael Van Canneyt
to Wayne Sherman
Wayne Sherman wrote 18 lines
On Sun, Oct 22, 2023 at 3:20 AM Michael Van Canneyt wrote: > Thanks to the efforts of Nikolay Nikolov, the FPC compiler can now recompile > itself to webassembly I just watched an interesting talk from StrangeLoop called: "Inside the Wizard Research Engine" by Ben L. Titzer https://www.youtube.com/watch?v=43ENxjq2Vhc The Wizard Research Engine is a WASM interpreter for research and analysis that can help compiler and program writers analyze and debug their code. It can be used to perform WASM code coverage, branch profiling, memory/cache profiling, dynamic call graph construction, debug breakpoints, watchpoint, tracing and fuzzing and fault injection. (see talk @ 11:14 and 13:54) Wizard: An advanced WebAssembly Engine for Research https://github.com/titzer/wizard-engine

Thank you. I didn't know this one yet !

The WebAssembly eco system is already so big, there are really great tools our there. I've reduced FPC generated modules to 1/3rd of their size, and the resulting webassembly runs faster than the original FPC generated (webassembly) code.

With the wasmtime or wasmedge library, Lazarus could integrate the FPC compiler into the lazarus binary: the module needs to be loaded only once, and can be executed as often as necessary. One can even imagine compiling packages in parallel in separate threads. Output can be read directly, no need to use processes, pipes etc.

Some benchmarking is of course needed to see if there is a speed benefit.

And we're just at the beginning.

I would not be surprised to see that webassembly will eventually make the JVM and C# runtime engines redundant...

Michael.

Reply by email