MimosaDoc.tioga
Copyright Ó 1989, 1991 by Xerox Corporation. All rights reserved.
Russ Atkinson (RRA) February 10, 1992 1:57 pm PST
Foote, May 18, 1993 4:39 pm PDT
MIMOSA
CEDAR —
Mimosa
-- the Cedar/Mesa compiler --
Russ Atkinson
© Copyright 1988, 1989, 1991, 1992 Xerox Corporation. All rights reserved.
Abstract: This is preliminary documentation for running the Mimosa compiler.
Created by: Russ Atkinson
Maintained by: Russ Atkinson <Atkinson.pa>
Keywords: Mimosa, Cedar, Mesa, compiler
XEROX  Xerox Corporation
   Palo Alto Research Center
   3333 Coyote Hill Road
   Palo Alto, California 94304

1. Mimosa
Introduction
Mimosa is a reworked version of the ancient Cedar/Mesa compiler. The intention is to eventually arrive at a compiler base that can have multiple targets. The current target is restricted to 32-bit words, byte addressing, big-endian bit and byte order (bit/byte 0 is most significant within a word), and code generation for the C language (specifically for Sun-3 and Sun-4).
Recent Changes
February 10, 1992, RRA
Fixed Pass4Xa.Index really do the same thing as the PCedar2.0 version. The last version had an editing bug that caused failures for some cases of indexing by biased amounts.
February 7, 1992, RRA
Fixed Pass4Xa.Index to do bounds checking properly. For some time now no bounds checking code has been generated for array access! We don't know exactly when this happened.
Made the F switch default true for PCedar2.0 and Cedar10.0. Also changed MimosaSequencer to make the F switch not take part in the version stamp (which should avoid the need to recompile definitions files for PCedar2.0).
December 17, 1991, RRA
Brought the Cedar 10.0 version up to date with the PCedar 2.0 version by addin the changes to Pass4Xa.
Also changed the default for the F switch (inline floating point) to TRUE, which should usually generate better code.
Running Mimosa from Cedar
Right now (December 17, 1991) Mimosa comes in several parts. There is a supporting package, IntCodePackage.bcd from IntCode.df. The front end, which generates intermediate code, is called Mimosa.c2c.o, and is governed by MimosaOnly-Suite.df. The back end, which translates from intermediate code to C, is called C2C.c2c.o, and is governed by C2C-Suite.df.
By default, you only need the Mimosa command to compile a program. To compile the program in the source file Test.mesa, for example, issue the command:
Mimosa Test
The above command will compile Test.mesa, producing the files Test.mob (symbols) and Test.c (code) as output, with error and warning messages going to the file Test.errlog, all in the working directory. Any needed symbols files must also be in the working directory.
To compile the resulting C file into an object file, you need to run the C compiler. The following aliases may be useful:
Alias compile (file) Mimosa -l -c -u file; mmcc file
Alias mmcc (file) MMCCMesa -class sun4 -name file -dir sun4> -mSw "-c -g -fsingle" -uSw ""
After making these aliases, issuing the command
compile FFF
will compile the file FFF.mesa into FFF.mob, FFF.c2c.c, and sun4/FFF.c2c.o, and the result can be run using the command
run FFF
Alternatively, one can use the makedo facility, which is particularly useful for making interelated modules and packages.
Switches
Single-character switches can be submitted on the command line to alter the behavior of the compiler. The case of switch characters does not matter. If the switch is given, then that sets the sense of the switch option for the following files on the command line, or until the switch is altered again. Specifying the switch character sets the sense to true, while preceding the switch character with ~ sets the sense to false.
Switch Default Effect 
A false [c2c] generate dbx style source macros
B true true => emit bounds checking
C false [c2c] etension: true => use .c2c.c, false => use .c
D true true => call debugger on error, false => log error
E false [c2c] reserved
F true [c2c] true => generate inline floating point
G false [c2c] true => leave trash {obsolete}
H true true => use new handler code {obsolete}
I false true => output intermediate code to .icd file
J false unused
K true true => emit smaller initialization code
L true [c2c] use LF (012C) for newlines in text output files
M false Mimosa only (no c2c generation)
N true true => emit NIL checking
O true [c2c] reserved
P false punt on warning or error (stops compilation)
Q false [c2c] true => generate calls for counted assignments
R false [c2c] true => use external proc names file {obsolete}
S false reserved (historical usage => sort variables)
T false [c2c] reserved
U false true => check for uninitialized variables
V false [c2c] generate line # file (and no source macros)
W true true => log warning messages
X false reserved
Y false reserved (temporary: emit extra warnings)
Z false reserved
As an example of switch syntax and usage, the following command:
mimosa -ym Test
will compile the file Test.mesa with the Y and M switches, which will produce additional warnings to the log file, and will generate the intermediate file Test.icd, but will not generate the C file Test.c.
The defaults given above are those used for the Mimosa compiler of May 15, 1991. These defaults may change on an installation-specific basis. For example, the D switch is likely to be false for installations without immediate debugging support.
[For experts only] Besides the letter switches, numeric switches can be given to force out listings of the symbol tables at the end of pass 2, pass 3, and pass 4. The switch number is the first pass for which tables are generated to the error log.
Checking switches
There are a set of single-charater switches to be used for checking for unusual or dangerous situations. All of these checking switches default to FALSE. All of the switches will raise warnings for suspected constructs. The checking switch specifications are case insensitive. The checking switches must be prefixed by %, as in:
Mimosa -%a TestFile.mesa
Switch Effect if TRUE  
A Address arithmetic portability
B unused
C unused
D unused
E Call from ENTRY to ENTRY procedure
F unused
G unused
H unused
I Warn about unsafe array indexing
J unused
K unused
L unused
M unused
N unused
O unused
P Suspiciously padded simple variables
Q unused
R unused
S unused
T unused
U unused
V unused
W extra word alignment checking
X unused
Y unused
Z unused