Source for the Ada- Compiler

Today I have created a repository containing Jan van Katwijk’s Ada- Compiler (pronounced as Ada Minus).

In the context of our Ada 83 Memory wiki we came across Jan’s PHD thesis from 1987. And it describes a compiler for a large subset of Ada. The main exclusion are floating and fixed point types. I reached out to Jan and he was very kind and happy to talk about the compiler. He searched his archives and found the source code from 1995 when he tried porting it to Linux.

This might be of interest to anyone with a fancy for programming history or folks who are working on bootstrapping GNAT from an Ada83 compiler.

11 Likes

I wondered if this was available. Just need Ada+ and Ada* now and that should be all the research compilers.

3 Likes

This is a wonderful piece of history!!! Thanks for all the research, work and digging stuff up!

1 Like

There is also:

“ADA1 - AN ADA SUBSET COMPILER FOR THE AFIT SYNTAX DIRECTED PROGRAMMING ENVIRONMENT” AFIT/GCS/MA/83D-4 which mentions “Background of the Ada0 Compiler” at the start, :woman_shrugging:

DEC Ada, wherever that is.

The Ada + compiler is being written as a part of the SPICE project at Carnegie-
Mellon University.

Ada-0 from Karlsruhe

Can’t remember where I saw Ada* now.

I also wouldn’t be surprised if a lot of these are based on the same compilers.

1 Like

Oh yeah, there were lots of Ada compilers in the 80s. Diving into this stuff feels a bit like untangling a knot of dark matter. It makes me realize how used I am to the free software community and the willingness to share code and being pretty much open about most things.

These old 80s papers can be real treasure troves. Van Katwijk’s thesis has a ton of references to other academic Ada-related endeavors. And if you start searching archive.org you will find a great many compiler validation reports from the DoD for compilers that are hardly mentioned anywhere else.

I do sometimes wonder how the programming world would look like if the early Ada compilers were all free and open. Even Ada 83 was a pretty full featured language and I doubt anyone would have wanted to reach for C++ if compilers were free and widely available.

6 Likes

There’s no cg folder in the repo :confused:

2 Likes

Looks like @jelle will need to recontact the author to see if he still has the cg directory somewhere.

It would be cool to get the m68k cg as well, I could try to get it working on the Amiga.

Structure of the source files, I did not document the actual purpose of each component for now.

  • Folder lib
    Helpful binaries for codegen1. From what I see only ldfile should be there

  • Folder src\codegen1
    Executables s68

  • Folder src\cgyaccsrc
    Executable cgyacc

  • Folder src\codegen2
    Executables cg68

  • Folder src\veyacc
    Executable veyacc

  • Folder src\libvy
    Static library libvy.a

  • Folder src\treetool
    Executable treetool

  • Folder src\view
    Static library viewlib.a
    Executables adarm newadalib rmadalib adaload printlib printview printcdb

  • Folder src\h
    Header file tree.h

  • Folder src\front
    Executables ada_front

  • Folder src\cg
    !! Missing !!
    Executable file ada_cg

  • Folder src\adadep
    Executables adaparse adadep

  • Folder src\rt
    Ada runtime in assembly and C
    Static library daslib.a
    Object files dasexit.o, dasrt0.o, std_ps.o
    Assembly files dasrt0.s dastaskrt0.s
    Tree file(???) std_ps.t

  • Folder src\standard
    Static library std.a

  • Folder src\amdb
    Executables amdb

4 Likes

Hah, wow, that’s amazing!! I didn’t expect someone to just grab this code and attempt to get it compiling of the bat, I love it! :smiling_face_with_three_hearts:

At first glance it seems that Andrii Kurdiumov hit one of the caveats that Jan van Katwijk mentioned to: “the Ada- compiler is itself probably needed to generate the tree representation for the Standard package”.

The reference to ada_cg is in the “standard” package in the repo and this package seems to contain a mapping from “standard” Ada types, procedures and functions to the ones that were implemented in DAS. DAS (Delft Ada Subset) was an earlier subset developed at Delft University. Some of the folks that worked on DAS also worked on Ada- and there was also some code reuse.

This standard package is a very tiny, albeit necessary, package to define basic types like integer and string and all the foundational operators that you will need. It maps those to the actual definitions in a C library from DAS.

I didn’t include a .gitignore on purpose, so all the previously object files and other compiler artifacts are all there. I really haven’t done a deep dive into the repo, but I suspect that the precompiled standard package can be found in the lib/std_ps.t file.

If we really want to make a serious effort in bringing this compiler back to life then work like Andrii did is incredibly valuable. It is a sort of nice and sweet quick sweep that allows us to quickly mark the “pain points” in doing a port to the 21st century.

A concerted effort would imo be a combination of these kind of best effort porting attempts, paired with a broader clean up and documentation effort so we have in debt knowledge on the workings of all bits and bobs.

The system seems to be a collection of separate sub systems that are compilable on their own (UNIX-philosophy, I like it ;-). It relates in a very loose manner to the structure of this compiler described in the thesis:

The structure of the frontend would be pretty recognizable to anyone who has done compiler dev in any unixy environment, with lex and yacc as the well-known regular guests :slight_smile: . The caveat here is that they use a pretty clever custom version of yacc. They didn’t choose to use DIANA for the high level representation, but their own rep. In my opinion this is a sensible choice. I probably wouldn’t use DIANA either if I built an Ada 83 compiler from scratch either. DIANA seems to be rooted firmly in the particular flavor of modularity that was very in vogue in the 80s. Anyone who’s nerding out on Ada’s 80s history might recognize this mindset from the “Ada Root compiler” initiative from those days.

There was a hope that if you could fence of particular parts then they could be used interchangeably. Really drinking the Unix Kool-aid, which I personally quite enjoy, but as with all things in moderation. The folks at Delft University realized this and a lot of code in this project has that nice old school C enthusiast hacker quality to it which I still very much enjoy in the BSD’s for example.

Anyway, I’m not yet sure I want to revive this compiler completely. Right now I’m mostly looking into it from a historic enthusiast perspective and really enjoying the cozy life of working with GNAT :smiley: . Having the source code next to the papers adds a great new dimension next to the old papers, and really helps bring this history to life. But maybe that’s something which maybe only programmers like us can really appreciate :nerd_face:

However, either wanting to revive this, or just enjoying the story: this project is open source now so it doesn’t depend on me or anyone in particular. The fact that Andrii took the free software spirit to heart and devoted an entire day on hacking on this makes me very giddy. I love this to bits! :smiling_face:

There’s really some interesting things about Ada- that might justify doing the work. It has tasking for example and that really makes it something special. If you read Jan’s thesis then you hear the belief that this compiler could be worked into something that covers Ada 83 completely. Given the supported feature set I think that’s indeed feasible. But it would require quite a bit of work. Work that’s also not in Ada, so you do have to enjoy C to a certain degree as well.

From a bootstrappers perspective doing a “quick and dirty” port to get this up and running might be more interesting and feasible. However, if you want to get a Ada 83 compiler out of this that’s sort of usable for anything other than hobby projects is another matter. That would require a special kind of fancy in search of tickling :slight_smile:

1 Like

Is the debugger and has manfiles you can view.

1 Like

Seems Georg Winterstein is still alive but i cannot contact him on linkedin. He is co-authoer of the Ada-0 compiler from Karlsruhe.

I did contact Carnegie-Mellon via fb about the Ada+ compiler, others contacting them might push them to release it if they still have the source.

1 Like

Nice to see you’re also on this forum! Quite neat how you went to work on this and documented the results! :raising_hands:

1 Like

It’s more to do with memory sizes on old machines of the time which break up a compiler into separate executables with many temp files between them.

Never heard of that and neither has the duckgo place.

J. van Katwijk also has a number of docs on acm which might be of use, e.g. A preprocessor for YACC or a poor man’s approach to parsing attributed grammars, full list.

2 Likes

Thank you for kind words all! My main motivation as I state in my post was mostly resurrecting old software, and make them more accessible. I believe that having something buildable, almost untouchable is important for learning how things working before. Especially if it’s so easy like Ada-. I also agree that historical sources should be preserved for archival purposes and kept separately from some revival efforts.

I cannot say that I look at things from Ada perspective, and I not C guy either, so if my work would help people learn Ada, I would be more then happy. If this would be even helpful for something practical - That’s beyond my wildest dreams :smile:

Anyway, from reaction, it seems I can continue this project (maybe a bit slowly) since people are mildly interested. Let’s see if my easily distracted mind can do something interesting from code drop.

1 Like

@Lucretia Yeah, memory limits were hard. As many have found, building an Ada Compiler with only 64kb of memory is pretty much impossible. Especially if you have to use tapes as your storage medium.

I’m not sure what created the “unix philosophy” as we now call it, but I imagine that the concepts around modular programming and “separation of concerns” that became popular in the 70s and the time sharing computers also played an important role. The history of unix is a whole ‘nother rabbit hole to enjoy :smiley:

Your search for the root compiler coming up empty underlines why digital preservation is important. They say that the internet doesn’t forget anything, but unless it’s an unfortunate photo of you in a Hawaii shirt at a college party, it’s actually very forgetful.

The root compiler is mentioned in Jan’s thesis:

@kant2002 Awesome that you want to continue with this! I intend to submit the original tarball with the code I got from Jan to archive.org. That allows us to not worry about that any more. So, you could merge your code into your main branch on Github and let that be the “revival” repo for example. Whatever you like :-). I can refer to your repo from my “historical” repo on sourcehut for example.

I will reach out to Jan with an update about this. I can ask him additional questions about the code base of course, but I don’t want to task him too much with that (Ada pun, sorry :-), since he’s enjoying his well-deserved retirement and hasn’t been active in the Ada community since being the Dutch representative from TC22/TG9 in evaluating Ada 95. So if there’s any questions you would like to ask, please let me know.

Pfft, only on the glorified 8-bit machines. My A500+ had 1MB I think and my A1200 had 256MB (at uni), but even on Amiga’s SAS/C and Dice C (based on and written with SAS) took the Unix approach.

That was the designers of unix, there’s a video of one of them talking about chaining small programs together on yt, search for the harvey mudd os course, he has a link to it on that.

It does, especially when sites have not been archived and with billionaires trying to destroy wikipedia and the interweb archive and then there’s universities who have stuff in their archives they have not opened up.

No chance of getting that released.

Just rename master/main to original_source or similar and rename the new branch to main.

I would ask about the missing cg dir.

1 Like

Just to tease you a bit. One bug squashed.
ada_front running and produce following debugging output. Hope to fix that soon.

Delft Ada- compiler (c) Delft University of Technology 1987/88
(c) Ada to C version of 1995
Compiling file deflib/binairy_io.ada
Voor creat lock

v lok 128 nr 128 n lok 129
get_cun 143
Vind van unit STD_PS de treename
viewname adaview
username kant
view adaview user kant
Not equal to adaview.root
Equal to adaview.kant library /mnt/d/d/github/Ada-Minus-Compiler/src/adalibrary
libname /mnt/d/d/github/Ada-Minus-Compiler/src/adalibrary
Openlib fd 4
Close van 4
get_libdesc goed:name /mnt/d/d/github/Ada-Minus-Compiler/src/adalibrary, uname STD_PS
Request to read from stream 4 lun 1 616 bytes
read_oclun 616 bytes few
getf_lun : llget van /mnt/d/d/github/Ada-Minus-Compiler/src/adalibrary fout, file STD_PS
get_lun status false
get_body fout
free cun 143
Voor creat lock
fc 128 fr start 0 lijstnr 0 lok 129
Cannot open package standard
3 Likes

Ooh, sweet! The standard package thing is a tiny bootstrap issue in itself, so that might pose an interesting challenge.

I do feel sorry for you, for having to work through the source that has Dutch comments mixed in there :hugs: . Let me know if it blocks you anywhere, so I can translate it.

I’m very much into localized software and not for end-user, but for software developers too. At least for educational purposes. So keeping Dutch is definitely good. I honestly did not decide what’s best for the project. So that’s good point for fathering feedback.

  • there READMEs or sort which I would like to translate.
  • There comments
  • There output messages

Should we translate? Does Dutch people want to have more Dutch content on the repo ?
For example I can create translation for output messages as form of diff, and it can be applied as part of the build.