Ada Bootstrap compiler funding thanks to nlnet!

I don’t know why that should be a huge problem: you already know how big the stack-frame-equivalent is, so you pop that amount off the stack, just as you would clean up the stack-frame for a normal compiler.

There’s several ways you can do it:

  1. Using a High Level Language as a Cross Assembler
  2. Target a VM
    1. P-Code is simple, but less well-known now;
    2. JVM is ubiquitous, making for a good cross-compile bootstrap platform;
    3. DOTNET is interesting, but more limited (there are implementations on non-MS OSes);
    4. Forth/SeedForth, very simple and small;
  3. LOLITA - A Low Level Intermediate Language for Ada+
    (This paper is the only ref to it, though, TTBOMK)
  4. Interpret/execute the IR directly.
    (This is technically what Graal/Truffle does, though the IR is essentially the AST.)

For the second point, I would not bet that Ada/Ed can be augmented to the required fraction of an x95 Ada compiler to process and code an early available gnat source.

I feel this enterprise will require a considerable endeavor.

Ah, but do you think it would be doable working on it for a year full-time?

My intuition is not very positive about the possibility to add enough Ada95 features to be able to compile an available earliest gnat. But advice from others are welcome and probably better than mine.

Nonetheless, a first task would be to recompile the Ada/Ed with a modern C compiler (standard normed C, not C++ or featured C). It seems there is no present Ada/Ed functional downloadable executable suite of it. for example the

is mainly a source archive (there are some execs though, but compiled for what ? )
This link is particularly interesting giving information on the internals of Ada/Ed (specially the files ais, tre, aix, axq and so on) :

Ada_Ed/c/Schonberg_Shields-From_Prototype_to_Efficent_Implementation-1985.pdf at 92667454af111cecf1fb23af470d6edec666385a · GunterMueller/Ada_Ed · GitHub

There are six execs to compile :

  • adafront the parser,
  • adagen the VM code generator,
  • adabind the code segments binder,
  • adaexec the interpreter,
  • adacomp a command interface,
  • adalib a librairian.

I had succeeded in recompiling the imain.c by curiosity, so the rest can almost surely be recompiled but there are compilation errors to correct to comply with today C.

IMPORTANT NOTE
This task of cleanly rebuilding and re-documenting Ada/Ed could be fairly useful by itself, that would give another open source Ada 83 working compiler (which will be mentioned on Ada83 memory site ada83.org of course). With a minimum of documentation complement on use options, it could be used again.

When updating C code to compile, perhaps you will figure out the symbol table structure or the tree representation. It is probably very specialized for Ada 83, so is extending it for some Ada 95 features possible ? Mystery. And for what Ada 95 features ? It depend on the early gnat content. All this has to be studied carefully. But I feel like not very optimistic. How do others feel ?

Thank you for the consideration. My interest lies in industrial automation, or any kind of machine really, using Plan 9 (9front fork) as the core platform from the engineering workstation down to the control CPU. I’ve done some work in this area and my interest is to use Ada in place of ST.

The main hurdles are the non standard Plan 9 C library and compiler suite which is mostly C99 compliant with some unique features. No in-line assembler. Lex and yacc. Not POSIX nor Unix. MIT license. These aren’t deal breakers, plenty of “foreign” C software has been ported such as Ghostscript and Python.

Plan 9 was designed for cross platform and all the source and tools are included by default. This means any supported architecture can bootstrap another just by changing the environment variable “objtype” and building. Ideally, a Plan 9 Ada bootstrap compiler should be completely architecture agnostic allowing one to set objtype=x and run the build. This is the hard part as you would need to emit a binary for each arch. Though it’s possible to use the same cross platform technique Go uses: emit Plan 9 assembler. Then hijack the existing linkers to build the target binary. Though, at that point you’re close to a native Ada compiler, which would be interesting.

As for the entirety of Gnat and the Ada standard library, I can’t speak for that. I am not sure what is needed to enable Gnat if it heavily relies on GCC and GNU C libraries. Might be a show stopper but I would like to investigate what is possible. In the mean time I Have to brush up on my Ada.

1 Like