Jim Hall wrote: > > On Mon, Jan 29, 2024 at 8:07 PM Jim Hall <jh...@freedos.org> wrote: > >> I am working on an academic project that requires understanding the > >> MAD programming language so I can pick apart (and faithfully recreate) > >> an old MAD program. That's the Michigan Algorithm Decoder, from 1959 > >> and the early 1960s. > >> [..] > >> Does anyone know of a MAD compiler for DOS?
Ralf Quint wrote: > Up to your email, I haven't even heard of a MAD compiler. Only the > magazine... 😛 > (and interesting seeing that mentioned in the Wikipedia article LOL) Yes, I hadn't heard of it either until a few months ago when I started researching the RUNOFF source code. It's written about half in MAD and about half in FAP (FORTRAN Assembly Programming). The RUNOFF program is written in MAD with some support functions in FAP. I'm thinking about writing a book about the early history of document preparation systems, and RUNOFF seemed a good place to start. I want to faithfully recreate the MAD code in another programming language - not an automated translation like ESR's translator would do, but an understandable recreation by a human who understands what the original code is doing and recreates it in a sensible way in another programming language. Might do it in C or BASIC. BASIC might be easier, since I'm seeing some similarities between MAD and BASIC. But I'd prefer to do it in C. But step #1 is to understand what's going on in the code. MAD is mostly readable, but the for-next loop equivalent is a little weird to me. For example, to loop from 1 to 10 (inclusive) in C, you'd do this: for (i = 1; i <= 10; i++) { ... } Just to compare: in FORTRAN77, it's like "DO label var = start, stop, step": DO 10 I = 1, 10, 1 ... 10 CONTINUE But in MAD, I *think* it's like "THROUGH label, FOR var = start, step, failcondition": THROUGH LOOP, FOR I = 1, 1, I .GT. 10 ... LOOP CONTINUE And from what I can see, I think "failcondition" gets tested at the end of each iteration, so it's more like this weird 'while' construction in C: i = 1; do { ... i++; } while ( !(i>10) ); That's why I wanted to write some sample code in a real MAD compiler, to see if I'm correctly understanding that (and a few other odd things in the language). _______________________________________________ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel