Re: PL/MIX

Steven Nichols <sdn@svpal.org>
9 Feb 2007 08:59:37 -0500

          From comp.compilers

Related articles
Re: PL/MIX usenet@rwaltman.net (Roberto Waltman) (2007-02-07)
Re: PL/MIX max@gustavus.edu (Max Hailperin) (2007-02-08)
Re: PL/MIX ara@nestle.csail.mit.edu (Allan Adler) (2007-02-08)
Re: PL/MIX usenet@rwaltman.net (Roberto Waltman) (2007-02-08)
Re: PL/MIX gah@ugcs.caltech.edu (glen herrmannsfeldt) (2007-02-08)
Re: PL/MIX sdn@svpal.org (Steven Nichols) (2007-02-09)
Re: PL/MIX ara@nestle.csail.mit.edu (Allan Adler) (2007-02-09)
Re: PL/MIX ara@nestle.csail.mit.edu (Allan Adler) (2007-02-11)
Re: PL/MIX ArarghMail702@Arargh.com (2007-02-12)
Re: PL/MIX Peter_Flass@Yahoo.com (Peter Flass) (2007-02-12)
Re: PL/MIX ara@nestle.csail.mit.edu (Allan Adler) (2007-02-16)
Re: PL/MIX ara@nestle.csail.mit.edu (Allan Adler) (2007-02-16)
[1 later articles]
| List of all articles for this month |
From: Steven Nichols <sdn@svpal.org>
Newsgroups: comp.programming,comp.compilers
Date: 9 Feb 2007 08:59:37 -0500
Organization: Silicon Valley Public Access Link
References: <y93hctzf4wz.fsf@nestle.csail.mit.edu> 07-02-018
Keywords: assembler
Posted-Date: 09 Feb 2007 08:59:37 EST

In comp.compilers Roberto Waltman <usenet@rwaltman.net> wrote:
>>Also, suppose one knows the architecture of a certain computer and
>>one has an assembly language for that computer (such as Knuth's MIXAL
>>for MIX) and one wants to produce an analogue of PL/I (assuming that
>>PL/MIX really is such an analogue) for that architecture which resembles
>>Knuth's description of more adequately reflecting data and control structures
>>resembling the Remarks field of the assembly language programs. How does
>>one go about producing such a variant? I get the impression from Knuth's
>>book that this is (or was) a standard activity that must have been done
>>on a lot of architectures.


You can make a control structure with a 2 dimensional array that contains
label suffixes, or string labels.


dim labels(16,2); //16 = number of nested structures, 2 = else and false
target labels.


Then set a structure level number pointer (used like a stack) to point
to the current structure, initialize your structure pointer and label
number.


structpoint = -1; // preincrimented
labelnum = 0; // produces a label 'label0, label1, etc'


Use it like this:


For this output //do this
------------------------------


BeginIF; //structpoint = structpoint + 1; elseflag = 0;
                      //create 2 labels
                      //labels(structpoint,1) = 'label1' Create 'else' label
                      //labels(structpoint,2) = 'label2' Create 'false' label


    If p1 > p2 Then; // true fall through, false then JMP to else label
        (true code here)


            Else; // output absolute jump to false target label
                          // output else target label labels(structpoint,1)
                          // set elseflag = 1


              (else code here)


EndIF; //if else command used (elseflag) , output false label
                                      //labels(structpoint,2)
                                      //if no else used, output else target label
                                      //labels(structpoint,1)
                                      //structpoint = structpoint - 1
                                      //labelnum = labelnum + 2


Steve


www.ml1compiler.org ;This should compile MIX (you write the macros).


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.