Running Ada in the browser

Some months ago I saw an article about a website that runs Linux and gcc in your browser thanks to WebAssembly (Linux And C In The Browser | Hackaday). I found it quite interesting as a way of providing an interactive shell for tutorials, but unluckily gnat-gcc wasn’t installed and trying to install it just resulted in an error.

However, this week I found out a similar project called jslinux which allows installing and running gnat in the browser (at least using the alpine vm):
https://bellard.org/jslinux/

It is quite slow, but I think it could have interesting use cases like interactive Ada courses without requiring the server to compile and run arbitrary untrusted software, testing alire packages before using them in a project or allowing newcomers to try Ada from ada-lang.io without installing anything.

1 Like

The tutorial of Learn.adacore.com does that:
https://learn.adacore.com/labs/intro-to-ada/chapters/imperative_language.html
It’s nice and interesting.
(I guess that the compilation/running is server side, but I don’t know.)

I’m not sure how they implemented that tutorial, but I suppose it runs serverside. However, running it in the browser could be quite interesting, as it would allow deploying it as a static GitHub page

I’ve been told that GNOGA applications can run server side and the client can view them in the browser, but I haven’t messed with it too much.

You also have LLVM and Webassembly

It’s server-side. They are using Vagrant and VirtualBox as can be seen here: GitHub - AdaCore/learn: Sources for learn.adacore.com

I’m afraid that if you try to install gnat on a Linux machine running in the browser, you might get the same error that you have when installing gnat-gcc on your machine :joy:

Installing gnat in my computer is not a problem. Both Linux images were virtual machines that run in the browser, being the first one (the one in which I got an error) optimized for running gcc