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

Ada->Javascript?

735 views
Skip to first unread message

tmo...@acm.org

unread,
Jan 20, 2015, 3:43:57 PM1/20/15
to
Does there exist any kind of Ada to Javascript translator? Even something
that took compilable, but not runnable, simple Ada to Javascript. Having
an Ada compiler check for typos, type errors, etc, and handle enumeration
types, non-zero array'first, etc etc would be a great help.

David Botton

unread,
Jan 20, 2015, 4:32:04 PM1/20/15
to
> Does there exist any kind of Ada to Javascript translator?

There does exist such a project, I asked on #Ada as I know its author hangs out there. I can't remember the name at the moment.

Paul Rubin

unread,
Jan 20, 2015, 5:33:21 PM1/20/15
to
In principle you could do this with an Ada-to-C translator (several
exist) followed by Emscripten. If the idea is just to get a strongly
typed language to run in the browser though, there are much better
alternatives. I've been looking at Purescript (purescript.org) which is
Haskell-like, while others like Dart are a bit more mainstream. The
thing to keep in mind is that Javascript is a managed, garbage collected
language, a design that trades off real-time and bounded-memory
capabilities for a lot more programming convenience. An Ada front end
would give up the convenience without getting the Ada capabilities back.
So something like Purescript is a better match.

tmo...@acm.org

unread,
Jan 20, 2015, 11:45:12 PM1/20/15
to
> (Javascript) ... a design that trades off real-time and bounded-memory
> capabilities for a lot more programming convenience.
So far I've seen two conveniences: 1) it runs everywhere, 2) it easily
interacts with the html page.
I'm not looking for tasking, generics, exceptions, tagged types,
assertions, or IO. But the "little things" in Ada I really miss:
Detecting errors with better syntax, required declarations, types to keep
the apples and oranges separate, and named parameter specification in
subprogram calls. Coding conciseness (and the resulting fewer errors)
with package modularity, letting me write "X := Y" to copy a record,
enumeration types, fixed point, and application-oriented array bounds.
Off the top of my head.
So a translator that just did some of the above, with a "compile time"
check for errors, would be a great help.

Vadim Godunko

unread,
Jan 21, 2015, 6:25:07 AM1/21/15
to
There is ongoing work, see http://forge.ada-ru.org/matreshka/wiki/Web/AdaToJavaScript/Examples. It is very limited now, features requests are welcome.

David Botton

unread,
Jan 21, 2015, 3:07:55 PM1/21/15
to
> But the "little things" in Ada I really miss

Why not just use Gnoga? Is like having Node.JS and JS and Ada all in one.

David Botton

tmo...@acm.org

unread,
Jan 21, 2015, 4:34:54 PM1/21/15
to
> Why not just use Gnoga? Is like having Node.JS and JS and Ada all in one.

For "Javascript conveniences", in addition to "runs everywhere" I should
have said "without needing an install or internet connection", eg,
strictly in a browser in a cell phone on a desert island.

David Botton

unread,
Jan 21, 2015, 4:57:41 PM1/21/15
to
> For "Javascript conveniences", in addition to "runs everywhere" I should
> have said "without needing an install or internet connection", eg,
> strictly in a browser in a cell phone on a desert island.

I don't have time yet (and others may beat me to it) but there will be a day not that long off when there is a compile to ASM.JS for Ada.

David Botton

brbar...@gmail.com

unread,
Jan 22, 2015, 8:39:13 PM1/22/15
to
There is also the templates parser for the Ada Web Server.
That should already handle JavaScript as well as XML. It may
be that the ACM folks wouldn't care if the code came as GPL.
The parser is embedded in the Web Server code and the templates
are brought in as external files. In principle, this should work
"in a browser in a cell phone on a desert island". [Interesting
situation - a desert island with a full-blown power plant to
recharge the phone, plus some way to beam in the text to be
translated. I suppose such an island also has a laser printer.]

Bruce B.

David Botton

unread,
Jan 22, 2015, 10:08:08 PM1/22/15
to
> There is also the templates parser for the Ada Web Server.

That wouldn't qualify as Ada running on the browser even in the most remote way of thinking. The idea of Ada -> JS or Ada -> ASM.JS (subset of JS) is to allow for complete client side applications. If Gnoga succeeds to draw interest and funds it will happen sooner rather than later. It's a far more solid solution to use a full client side Ada / Gnoga solution and it offers a better development model than yet another JS replacement language with the same typical DOM access.

When the kids are done with braces they can learn to be engineers :)

In general if there is already a server present using Gnoga it makes more sense for Applications. If just dumping pages of data, the traditional http server model of AWS makes more sense using templates.

David Botton
0 new messages