[net.lang.mod2] Modula-2 under BSD 4.2

andy@lasspvax.UUCP (Andy Pfiffer) (10/18/85)

[You hit the line eater -more-]

Okay folks, I've broken down and dug out some documentation on the Modula-2
compiler from DEC.  Enough people were interested in this hard-to-find
"unsupported" product that I decided that I help out.  Please note that I
am not affiliated with DEC, but that I like hyping a good product that
sells for a reasonable price.

I honestly don't know if they still sell it (Oswego got their copy in 
early January of this year), and they may have only provided it to
universities.  In any case, here are some facts (which may or may not
be fiction):

(Quoted without permission...) [my notes are in these brackets]

The DECWRL Modula-2 compiler distribution consists of several programs.
The compiler itself is divided into three phases:
the front end, the back end, and the intermodule checker.
There is also a program to invoke the various phases of the compiler,
a small runtime library, some updates to DBX, and a tool for helping
convert programs from Pascal to Modula-2.

	[the updates to DBX ended up crashing the whole system]
	[caveat emptor!]

The first phase of the compiler parses an individual Modula-2 module and
compiles it into P-code.  It consists of about 17,000 lines of Pascal
program and 1,000 lines of YACC grammar.  It includes an optimizer that
eliminates common subexpressions, moves invariants out of loops, allocates
registers, and performs other optimizations.

	[this is good clean code...]

The second phase of the compiler translates P-code into VAX instructions.
It consists of about 6,000 lines of Pascal program.  It folds constants
and selects instructions in order to reduce execution time.

	[this part was a real memory hog and generated bad code for...]
	[...some constant expressions.]

The intermodule checker examines a collection of object modules to be sure they
are consistent.  It consists of about 2,500 lines of Modula-2 program.
Optionally, it will recompile any out-of-date modules.

A program to help convert Pascal programs into Modula-2 is provided.
It consists of about 1,800 lines of Pascal and 1,000 lines of YACC grammar.

	[this works okay...but...]

SELECTED FEATURES OF THE COMPILER
Compiles comparable programs faster than the Berkeley Pascal compiler.
Benchmarks indicate code is comparable to the fastest VAX compilers.

	[True.  The final code was the fastest stuff on the machine!]

Built-in I/O library similar to Unix printf/scanf.
Automatic recompilation based on actual dependencies, not timestamps, in order
to minimize recompilations.
Generated code is compatible with Berkeley Pascal and Unix C.
Easy to call Pascal or C from Modula-2 and vice-versa.

	[read "easy" as "almost pretty easy"]
	[I spent quite a few hours staring at assembler produced by...]
	[...the C compiler and the Modula compiler...]

Accepts the language as defined in the Modula-2 report.
Uses compile-time switches to relax restrictions in the case of reserved
words and identifiers.

	[I liked this feature...]

COMPILER ANNOUNCEMENT 1/31/84
The Western Research Laboratory of Digital Equipment Corporation is pleased
to announce the availability of a new, experimental Modula-2 compiler for
the VAX and UNIX for university use.  We are licensing interested colleges
and universities to receive and use this compiler for internal, noncommercial
use for a fee of $100 to cover our distribution costs.

	[Hmmmm...]

The compiler was designed and built by Michael L. Powell and it appears to
be one of the best compilers for the VAX in terms of the efficiency of the
generated code.  The error messages are slightly better than those from the
Unix C compiler and the compile time is slightly worse.  Below is a table
of execution times on a set of ten benchmarks that John Hennessy at Stanford
has assembled.  All the times are in CPU seconds on a VAX 11/780 with FPA.
All compilers were asked to generate the best code they could and all
optional run time checks were turned off.  All versions of the programs
were as syntactically and semantically similar as possible.

Prog. Cambridge BerkeleyUnix  DEC     DEC   DEC  VAXElan Stanford DEC
 Name  Modula-2 Pascal   C    Pascal   C  Bliss32 Pascal Pascal Modula-2
========================================================================
 Perm     4.9    2.7    2.6    2.5    2.5    2.5    2.5    2.2    2.0
 Towers   6.1    2.8    2.6    2.6    2.7    2.5    2.6    2.1    1.9
 Queens   2.8    1.6    1.0    1.1    0.7    0.7    0.9    1.5    0.9
 Intmm    4.9    2.2    1.7    1.1    0.8    1.4    0.8    0.7    0.8
 Mm       5.0    2.7    2.2    1.1    1.3    1.4    0.8    0.7    0.9
 Puzzle  24.6   12.9   12.4    6.2    4.9    5.8    6.5    4.9    4.1
 Quick    2.8    1.7    1.2    1.2    0.8    0.8    0.8    1.0    0.8
 Bubble   5.5    3.0    1.7    1.3    1.0    1.1    0.9    1.4    1.0
 Tree     6.7    6.4    6.2    4.1    3.4    3.2    3.8    1.9    1.9
 FFT      9.7    4.8    4.1    2.5    2.6    1.5    1.2    1.8    1.6
Int Comp  9.9    5.5    4.8    3.5    3.1    3.1    3.1    2.6    2.3
Real Com 14.2    7.7    6.7    4.6    4.3    3.9    3.7    3.4    3.1

The integer and real composite numbers in the last two lines are
Hennessy's weighted averages of the previous lines -- his attempt to
summarize the results.  The above performance information is provided
for guidance only.  Your mileage may vary.

	[When I was at Oswego we received similar results...]
	[So, where do I sign? ]

If you are a college or university and are interested in this compiler,
we can send you some tech reports and copies of the license agreement
that you should have signed by the appropriate licensing office of your
institution.  We can then send you a tar tape that you should be able to
install and run with no more than the usual amount of associated grief
on Berkeley Unix 4.x BSD.  There is no Unix material on the distribution
so we don't need to see your Unix license.  The distribution also includes
a program that does most of the translation of Pascal programs into Modula-2.

	{...decvax|...ucbvax}!decwrl!powell
or
	powell@decwrl.csnet
or
	Michael L. Powell
	Digital Equipment Corporation
	Western Research Laboratory
	4410 El Camino Real
	Los Altos, CA  94022

	[Oh, and one final thing...]

Please be fully aware that this experimental compiler is not a DEC product
and is not for sale.  Our aim in distributing this compiler is a public
service one.  The license agreement does, however, protect DEC's option
to make this compiler into a product someday.

====[end of included stuff]====

	So, there it is.  Please DEC, don't sue me.  I was just trying
to help out.  Maybe there is a marketing rep from DEC out there who should
notice that there is a market for this compiler....

Mr. Powell, if you are reading, I apologize for lobbing your address
out on the net.  Please people -- try your regional sales office first.

Andy

-- 
=========================================================
USENET:	{decvax,ihnp4,cmcl2,vax135}!cornell!devvax!andy
ARPA:	andy%devvax@Cornell.arpa
MAIL:	Theory Center/265 Olin Hall   "What do you mean
	Cornell University             I watch too much
	Ithaca, NY  14853              TV?"
PHONE:	(607) 256-8686
=========================================================

ken@rochester.UUCP (and Vicki Herrieschopper) (10/21/85)

We too have had some experience with Powell's compiler. If I appear to
be critical, it is because I am leaving out the praises. With a some
(more than a little, certainly) work it could be a production quality
compiler.

In article <606@lasspvax.UUCP> andy@lasspvax.UUCP (Andy Pfiffer) writes:
>The first phase of the compiler parses an individual Modula-2 module and
>compiles it into P-code.  It consists of about 17,000 lines of Pascal
>program and 1,000 lines of YACC grammar.  It includes an optimizer that
>eliminates common subexpressions, moves invariants out of loops, allocates
>registers, and performs other optimizations.
>
>	[this is good clean code...]

Nested modules are not done correctly. It bombs out on some programs.
Also the error messages are not the most informative, i.e. syntax error
at line ..., a la C.

>The second phase of the compiler translates P-code into VAX instructions.
>It consists of about 6,000 lines of Pascal program.  It folds constants
>and selects instructions in order to reduce execution time.
>
>	[this part was a real memory hog and generated bad code for...]
>	[...some constant expressions.]

Complicated expressions can cause this to barf.

>A program to help convert Pascal programs into Modula-2 is provided.
>It consists of about 1,800 lines of Pascal and 1,000 lines of YACC grammar.
>
>	[this works okay...but...]

The Pascal grammar provided is wrong and it objects to some legal
Pascal programs in particular case statements. It is only an hours work
to fix it though. I am trying to send my changes back to Powell (are
you there?).

>SELECTED FEATURES OF THE COMPILER
>Compiles comparable programs faster than the Berkeley Pascal compiler.
>Benchmarks indicate code is comparable to the fastest VAX compilers.
>
>	[True.  The final code was the fastest stuff on the machine!]

The procedure call mechanism is very efficient for "internal" procedures.
This compiler was mentioned as an example of software RISCiness in a
recent CACM article on RISC architectures.

A good deal if you can still get it. I hear Digital is considering
using Modula-2 as their systems language. However the ETH compiler
may give it a run for the money, see a previous announcement.

	Ken
-- 
UUCP: ..!{allegra,decvax,seismo}!rochester!ken ARPA: ken@rochester.arpa
USnail:	Dept. of Comp. Sci., U. of Rochester, NY 14627. Voice: Ken!

tli@oberon.UUCP (Tony Li) (10/24/85)

Please people -- DON'T contact your regional sales office to get DEC
Modula-2.  It is ONLY available from decwrl....

;-)
-- 
Tony Li ;-)		Usc Computer Science
Uucp: ...!{{decvax,ucbvax}!sdcsvax,hplabs,allegra,trwrb}!sdcrdcf!uscvax!tli
Bitnet: tli@uscvaxq, tli@jaxom, tli@ramoth
Csnet: tli@usc-cse.csnet
Arpa: tli@usc-ecl.arpa