Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Any chance of programming a web frontend in Ada 2012?

428 views
Skip to first unread message

Marius Amado-Alves

unread,
Jun 8, 2021, 4:56:15 AM6/8/21
to
It seems that currently the only languages web browsers execute reliably are JavaScript and JBC (Java Byte Code) , with WASM (Web Assembly) soon to join the group.

Is there a way to program a web frontend in Ada 2012, maybe by translation to one of the above languages?

(Preferably with a binding to the DOM and the BOM.)

(Maybe via LLVM? GNAT already generates LLVM, right?)

Thanks a lot.

Jeffrey R. Carter

unread,
Jun 8, 2021, 5:21:26 AM6/8/21
to
Have you looked at Gnoga? https://sourceforge.net/projects/gnoga/

--
Jeff Carter
"Ada has made you lazy and careless. You can write programs in C that
are just as safe by the simple application of super-human diligence."
E. Robert Tisdale
72

Max Reznik

unread,
Jun 8, 2021, 5:35:27 AM6/8/21
to
Indeed, there is a project to run Ada in the browser using WebAssembly. It's name AdaWebPack[1].
It provides a toolchain based on GNAT LLVM and a customized runtime.
The runtime has some restrictions for now, such as no exception handling due to current
state of WebAssemlby. The toolchain building could be complicated, so the project provides
a Docker image.

The project provides the simplest example (See online: https://www.ada-ru.org/files/wasm/index.html).
This site (in Russian) uses it to provide some construction calculations https://mycalcs.ru/
Also take a look a short blog post: https://blog.adacore.com/android-application-with-ada-and-webassembly

I think, you can reach the author on the Telegram channel https://t.me/ada_lang

[1] https://github.com/godunko/adawebpack

Luke A. Guest

unread,
Jun 8, 2021, 9:21:02 AM6/8/21
to
There's always been CGI, there is a FastCGI implementation, my SCGI is
nowhere near complete, and may as well be dead tbh.

Marius Amado-Alves

unread,
Jun 8, 2021, 9:42:51 AM6/8/21
to
> Jeff Carter
> "Ada has made you lazy and careless. You can write programs in C that
> are just as safe by the simple application of super-human diligence."
> E. Robert Tisdale

Jeff, I thought your signature quotes were random, but this one... just replace C with JavaScript.

Marius Amado-Alves

unread,
Jun 8, 2021, 10:12:19 AM6/8/21
to
> There's always been CGI, there is a FastCGI implementation, my SCGI is
> nowhere near complete, and may as well be dead tbh.

Thanks, Luke. I've used CGI in the past (~2000). But now I'm a grown man and want to use a single language:-)

(
Cannot refind the meme now. 'Twas something like this:
beginner web developer: {HTML...}
intermediate: {HTML, CSS, Javascript...}
master: {Javascript}
)

Luke A. Guest

unread,
Jun 8, 2021, 10:43:24 AM6/8/21
to
On 08/06/2021 15:12, Marius Amado-Alves wrote:
>> There's always been CGI, there is a FastCGI implementation, my SCGI is
>> nowhere near complete, and may as well be dead tbh.
>
> Thanks, Luke. I've used CGI in the past (~2000). But now I'm a grown man and want to use a single language:-)

Eh? Surely you know CGI is basically stdin/out right? SCGI and FastCGI
is just that over sockets and you can use Ada.

Marius Amado-Alves

unread,
Jun 8, 2021, 10:45:01 AM6/8/21
to
> Have you looked at Gnoga? https://sourceforge.net/projects/gnoga/

Yes. Looks great and reliable. Quick read of the well written user_guide (I must be rainman cause I spotted this typo: Gnoga.Gui.Ekement.Canvas)

Looks too complicated for my present needs, but definitely a reference to keep. Thanks, Jeff.

Marius Amado-Alves

unread,
Jun 8, 2021, 10:55:51 AM6/8/21
to
> > Thanks, Luke. I've used CGI in the past (~2000). But now I'm a grown man and want to use a single language:-)
> Eh? Surely you know CGI is basically stdin/out right? SCGI and FastCGI
> is just that over sockets and you can use Ada.

Thanks, yes, then maybe I'm missing something, I dont see how that lets an Ada program run *in the browser*.
I used CGI to pass information (including generated HTML and the like) between the Ada program running as (and in a) server and the browser, an arquitecture still requiring non-Ada languages in the front end.
Maybe I was doing it wrong.

Marius Amado-Alves

unread,
Jun 8, 2021, 11:01:21 AM6/8/21
to
A number of ideas keep tickling my mind on how to do this. One is using ASIS to translate Ada to JavaScript, a kind of Ada compiler with Javascript as the target language.

Luke A. Guest

unread,
Jun 8, 2021, 11:08:21 AM6/8/21
to
CGI programs are started by the browser on the server, SCGI and FastCGI
are servers running on the server. See

https://github.com/Lucretia/ether
https://github.com/reznikmm/matreshka

If you want front end stuff, i.e. WebAssembly, you can do that, see

https://groups.google.com/g/comp.lang.ada/c/X-x1e-4w7dk/m/09nYKa-RAwAJ (Me)
https://groups.google.com/g/comp.lang.ada/c/i7niKZL8HAU/m/Y4I03LnLAgAJ
(Maxim)
https://blog.adacore.com/use-of-gnat-llvm-to-translate-ada-applications-to-webassembly

Max Reznik

unread,
Jun 8, 2021, 11:22:55 AM6/8/21
to
Speaking about "a single language" for frontend and backend. There was an idea to port Annex E (DSA) to AdaWebPack and use it as a communication channel between a web server written in Ada and WebAssembly client part.


вторник, 8 июня 2021 г. в 12:35:27 UTC+3, Max Reznik:

Jeffrey R. Carter

unread,
Jun 8, 2021, 12:04:44 PM6/8/21
to
I guess pseudo-random is technically correct (from a set of 203 without
duplication), but sometimes serendipity strikes.

--
Jeff Carter
"Ada has made you lazy and careless. You can write programs in C that
are just as safe by the simple application of super-human diligence."
E. Robert Tisdale
72

Luke A. Guest

unread,
Jun 8, 2021, 12:06:16 PM6/8/21
to
On 08/06/2021 16:22, Max Reznik wrote:
> Speaking about "a single language" for frontend and backend. There was an idea to port Annex E (DSA) to AdaWebPack and use it as a communication channel between a web server written in Ada and WebAssembly client part.

But?

Maxim Reznik

unread,
Jun 8, 2021, 12:19:43 PM6/8/21
to
вторник, 8 июня 2021 г. в 19:06:16 UTC+3, Luke A. Guest:
> But?

But, there is
* no interest from the community
* no interesting projects where I can use this idea
* no enough free time

Maxim Reznik

unread,
Jun 8, 2021, 12:26:58 PM6/8/21
to
вторник, 8 июня 2021 г. в 18:01:21 UTC+3, amado:
> A number of ideas keep tickling my mind on how to do this. One is using ASIS to translate Ada to JavaScript, a kind of Ada compiler with Javascript as the target language.

I did some progress in this direction, but ASIS4GNAT is abandoned and my project is suspended. The only user I have moved to AdaWebPack :)
The source code of the translator is part of the Matreshka project.

https://forge.ada-ru.org/matreshka/wiki/Web/A2JS
There is GitHub mirror:
https://github.com/reznikmm/matreshka

J-P. Rosen

unread,
Jun 9, 2021, 1:02:44 AM6/9/21
to
Le 08/06/2021 à 18:26, Maxim Reznik a écrit :
> I did some progress in this direction, but ASIS4GNAT is abandoned and my project is suspended.

ASIS4GNAT is not abandonned, it is just not part of the CE edition. Pro
users have access to it.

Please drop me a note if you have developped an ASIS tool, or are using
an ASIS-based tool. With enough protests, we may convince AdaCore to
make ASIS4GNAT available to the community.

--
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52
https://www.adalog.fr

Shark8

unread,
Jun 10, 2021, 9:33:56 AM6/10/21
to
On Tuesday, June 8, 2021 at 9:22:55 AM UTC-6, Max Reznik wrote:
> Speaking about "a single language" for frontend and backend. There was an idea to port Annex E (DSA) to AdaWebPack and use it as a communication channel between a web server written in Ada and WebAssembly client part.

I've been advocating this idea [well similar, I'm nor a fan of WASM] for years now.
Seriously: The DSA has the potential to be the Ada equivalent of being the "killer app" or "killer feature" for getting use.

Shark8

unread,
Jun 10, 2021, 11:16:35 AM6/10/21
to
On Tuesday, June 8, 2021 at 10:19:43 AM UTC-6, Maxim Reznik wrote:
> вторник, 8 июня 2021 г. в 19:06:16 UTC+3, Luke A. Guest:
> > But?
>
> But, there is
> * no interest from the community
There is it's just that point three makes it a bit harder.
> * no interesting projects where I can use this idea
There are LOTS of programs that could use this idea; essentially anything that you could use as a single application and split-up on server/client lines could be used.
> * no enough free time
This is the biggest factor, I think.
That and there appears to be some difficulty (as in non-compliance to the standard) WRT GNAT and the DSA; Dmitry would have more details there, as he has his own RPC/DSA implementation ready to go, IIRC.

Shark8

unread,
Jun 10, 2021, 11:18:56 AM6/10/21
to
On Tuesday, June 8, 2021 at 10:26:58 AM UTC-6, Maxim Reznik wrote:
> вторник, 8 июня 2021 г. в 18:01:21 UTC+3, amado:
> > A number of ideas keep tickling my mind on how to do this. One is using ASIS to translate Ada to JavaScript, a kind of Ada compiler with Javascript as the target language.
> I did some progress in this direction, but ASIS4GNAT is abandoned and my project is suspended. The only user I have moved to AdaWebPack :)
> The source code of the translator is part of the Matreshka project.
Damn.
I was hoping to see more on the translator.
Especially if it could be integrated into GNOGA, that way we could write everything in Ada and have the GNOGA-frontend-JS be generated from the same set of source.
I'll have to take another look at it, but like I said upthread, time is the big issue.

Luke A. Guest

unread,
Jun 10, 2021, 11:43:06 AM6/10/21
to
On 10/06/2021 16:16, Shark8 wrote:
>> * no enough free time
> This is the biggest factor, I think.
> That and there appears to be some difficulty (as in non-compliance to the standard) WRT GNAT and the DSA; Dmitry would have more details there, as he has his own RPC/DSA implementation ready to go, IIRC.
>

This, for this and other OSS projects, could be ameliorated by the
company's who sell compilers, all of them, not just AdaCore, funding or
helping fund the development of various OSS projects. I saw something
about of reddit recently I think where people were saying that OSS
projects just die out because the maintainers just burn themselves out
doing a full time job (for money) and then trying to keep OSS projects
going (for no money).

Paul Rubin

unread,
Jun 10, 2021, 8:44:21 PM6/10/21
to
It's unclear to me why anyone would want to do this, since it combines
the disadvantages of both Javascript (interpreted, non-deterministic
execution) and Ada (manual memory management etc.)

If you want to use a typed language that gets translated into
Javascript, you might be better off using Purescript (purescript.org) or
even something like Agda.

Ada to WASM might make more sense than Ada to Javascript, of course.

Stephen Leake

unread,
Jun 11, 2021, 2:47:19 PM6/11/21
to
"J-P. Rosen" <ro...@adalog.fr> writes:

> Le 08/06/2021 à 18:26, Maxim Reznik a écrit :
>> I did some progress in this direction, but ASIS4GNAT is abandoned
> and my project is suspended.
>
> ASIS4GNAT is not abandonned, it is just not part of the CE edition.
> Pro users have access to it.

On the other hand, if you are starting a new project, libadalang is a
better choice.

--
-- Stephe

J-P. Rosen

unread,
Jun 11, 2021, 4:31:30 PM6/11/21
to
What makes you think so?

By all means, compare the specifications of an ASIS package
(Asis.Statements, Asis.Declarations) to Libadalang.Analysis and see
which one is more usable...

Rod Kay

unread,
Jun 12, 2021, 6:47:36 AM6/12/21
to
On 9/6/21 3:02 pm, J-P. Rosen wrote:
>
> Please drop me a note if you have developped an ASIS tool, or are using
> an ASIS-based tool. With enough protests, we may convince AdaCore to
> make ASIS4GNAT available to the community.
>

I switched from ASIS to libadalang for an Ada IDE project also, since I
thought ASIS was abandoned.

J-P. Rosen

unread,
Jun 12, 2021, 10:04:20 AM6/12/21
to
If you want to analyze code while it is being typed, as is common in an
IDE, Libadalang is certainly the way to go.

If you want to make sophisticated analysis tools, it's another story.
Hopefully, my paper at AE will soon be available...

Shark8

unread,
Jun 14, 2021, 8:37:58 AM6/14/21
to
On Saturday, June 12, 2021 at 8:04:20 AM UTC-6, J-P. Rosen wrote:
>
> If you want to make sophisticated analysis tools, it's another story.
> Hopefully, my paper at AE will soon be available...

Oh, I am looking forward to reading it.
BTW, I really liked your "Memory Management in Ada 2012" video; I've used it as a reference several times to explain to Rust-people that Ada is safer than expected because pointers aren't required for a lot of things, and so you don't have to worry about null-exclusion.

Marius Amado-Alves

unread,
Jun 15, 2021, 5:40:43 PM6/15/21
to
Is JGNAT reliable, updated, available?
Thanks.

J-P. Rosen

unread,
Jun 16, 2021, 4:41:33 AM6/16/21
to
Le 15/06/2021 à 23:40, Marius Amado-Alves a écrit :
> Is JGNAT
>reliable,
I didn' try it enough to answer this

> updated,
No. The latest version is 2013. Another one of the useful stuff
abandonned by AdaCore.

> available?
Yes, from Adacore's community download page.

Maxim Reznik

unread,
Jun 24, 2021, 8:36:26 AM6/24/21
to
If somebody wants to try WebAssembly with Ada, I've updated the toolchain RPM and wrote short how to use docker to run the toolchain in case don't have Fedora 33:

https://github.com/godunko/adawebpack/issues/10#issuecomment-867544835

Marius Amado-Alves

unread,
Jun 24, 2021, 5:28:23 PM6/24/21
to
On Thursday, 24 June 2021 at 13:36:26 UTC+1, Maxim Reznik wrote:
> If somebody wants to try WebAssembly with Ada, I've updated the toolchain RPM and wrote short how to use docker to run the toolchain in case don't have Fedora 33:
>
> https://github.com/godunko/adawebpack/issues/10#issuecomment-867544835

Thanks.
Looks like you've done a fantastic job.

Personally I will not try this soon because:
- I hear Wasm does not support exceptions
- it looks like it has too many dependencies; I dont have time to manage that

Marius Amado-Alves

unread,
Jun 25, 2021, 3:44:34 AM6/25/21
to
"""
- nested subprograms are not supported
- exceptions support is limited to local exceptions propagation and last chance handler
- protected objects and tasks are not supported
"""
(https://github.com/godunko/adawebpack)

Are these limitations of Wasm, LLVM, or of any of the translators (Ada->LLVM, LLVM->Wasm)? Thanks.

Marius Amado-Alves

unread,
Jun 25, 2021, 3:50:43 AM6/25/21
to
On Wednesday, 16 June 2021 at 09:41:33 UTC+1, J-P. Rosen wrote:
> Le 15/06/2021 à 23:40, Marius Amado-Alves a écrit :
> > Is JGNAT
> >reliable,
> I didn' try it enough to answer this
>
> > updated,
> No. The latest version is 2013. Another one of the useful stuff
> abandonned by AdaCore.
>
> > available?
> Yes, from Adacore's community download page.
> --
> J-P. Rosen

Thanks, J-P.
I might still check JGNAT out, if it is easy to install (like GNAT which is super easy).
Curious to see how much of Ada 2012 it supports, given that it is of 2013.

Maxim Reznik

unread,
Jun 25, 2021, 5:08:45 AM6/25/21
to
AFAIK it's impossible to change stack pointer in WebAssembly now. That's why you can unwind stack on exception nor create another stack for a new task. However this is not critical for the web development from my POV.

пятница, 25 июня 2021 г. в 10:44:34 UTC+3, amado...@gmail.com:

Marius Amado-Alves

unread,
Jun 26, 2021, 7:59:42 AM6/26/21
to
On Tuesday, 8 June 2021 at 16:22:55 UTC+1, Max Reznik wrote:
> Speaking about "a single language" for frontend and backend. There was an idea to port Annex E (DSA) to AdaWebPack and use it as a communication channel between a web server written in Ada and WebAssembly client part.

An implementation of the DSA with browsers as nodes would be ideal IMO.

But not if the implementation requires you to spend hours, days installing, configuring things outside, around Ada. As AdaWebPack seems to.

Is there such a beast? A DSA implementation (even without web nodes) that deploys at the push of a button? Polyorb? (Which seems to have replaced gnatdist.)

Marius Amado-Alves

unread,
Jun 26, 2021, 8:05:52 AM6/26/21
to
On Friday, 25 June 2021 at 10:08:45 UTC+1, Maxim Reznik wrote:
> AFAIK it's impossible to change stack pointer in WebAssembly now. That's why you can unwind stack on exception nor create another stack for a new task. However this is not critical for the web development from my POV.

And I agree, thanks. I'll try to allocate a couple hours (days?) to test drive AdaWebPack, as it seems the most updated solution.

Vadim Godunko

unread,
Jun 26, 2021, 3:51:57 PM6/26/21
to
I think classic DSA doesn't fit modern web programming well for may aspects, for instance, user experience (user expect to have some indication of on going request processing), application architecture (Web application is usually event driven and asynchronous), etc.

GNATLLVM/WASM provides good enough basement to develop applications. I've some experience and should say that UI development with AdaWebPack is little more complicated compare to JS. From the over side, in case of some applications it is possible to reuse old (and develop new) code on both client and server sides, and it simplify development of the application in large. One more nice thing is same memory layout in WASM VM and x86 CPU, it allows to transfer binary data without any additional conversion.
0 new messages