Modula-3 for Energize

Modula-3 for Energize


This is a modified version of the DEC SRC Modula-3 compiler, which adds the ability to communicate with the Energize Programming System from Lucid, Inc. This enables the Energize browsing tools to be used on Modula-3 code.


This is experimental software which is being made available without charge on an as-is basis. It is not supported by Lucid, Inc. There is no warranty of any kind, so use at your own risk.


This version is for release 3.3 of the Modula-3 compiler and release 3.0 (or later) of Energize, on a Sun SPARCstation running SunOS release 4. (It is possible to use it with Energize release 2, but that doesn't work well enough to be very useful because release 2 doesn't understand modules.)

If you don't already have the DEC SRC compiler, either use the World Wide Web to access: (this is also a good source of general information about the Modula-3 language) or get it by FTP:

    % ftp
    Name: anonymous
    Password: <your e-mail address>
    ftp> cd pub/DEC/Modula-3/release-3.3
    ftp> get README

and then follow the directions there.

For information about purchasing Energize, send e-mail to "" or call Lucid sales at 1-800-223-9322.

Getting the files

The compiler extension for Energize can be obtained by anonymous FTP from Lucid as follows:

    % ftp
    Name: anonymous
    Password: <your e-mail address>
    ftp> cd /pub/hacks/energize
    ftp> binary
    ftp> get modula-3-SPARC-3-3.tar.gz
Or from gatekeeper as follows:

    % ftp
    Name: anonymous
    Password: <your e-mail address>
    ftp> cd /pub/DEC/Modula-3/contrib/energize
    ftp> binary
    ftp> get modula-3-SPARC-3-3.tar.gz

If you want to be able to build the extended compiler from source, then pick up the file modula-3-source-kit.tar.gz. This includes the connection libraries for building for either SunOS or Solaris.

Installation and use

Assuming that you have already installed the standard releases of both the SRC compiler and Energize, the following additional files are provided in this package, to be added to the installation directory of the Modula-3 compiler:

An alternate version of "m3c", the compiler front-end.
This is a script which is used like "m3" (the compiler driver) except that it uses "m3c-ez" instead of "m3c" and if the optional argument "-Xez" is supplied, the compiler will connect to Energize.
This script is like "m3build" except that it uses "m3-ez" instead of "m3", passing the "-Xez" argument if supplied, and it uses the Energize incremental linker instead of "ld". It also uses "energize_make_target" to record a build command for the target program.
Once these are copied into your installation directory, you will need to edit the pathnames in the two script files to match the location of your installation.

Also, you will want to be sure to take advantage of the Emacs mode support for Modula-3. Your ".emacs" file should contain something like this:

  (autoload 'modula-3-mode "/usr/local/modula3/lib/elisp/modula3" nil t)
  (setq auto-mode-alist
        (cons '("\\.[im][3g]$" . modula-3-mode) auto-mode-alist))
  (setq completion-ignored-extensions
        (append completion-ignored-extensions
	        '( ".mo" ".mx" ".mc" ".io" ".ix" ; Modula-3 internal files

The file "modula3.el" is included in the SRC distribution as part of file "tools.tar.gz". Alternatively, there is a slightly older version in the Energize 3.0 directory as "$ENERGIZE_ROOTDIR/etc/unsupported/elisp/nm3.elc".

Thus, where you would normally do a build by:

if you instead do:
    m3build-ez -Xez
then the compiler and linker will connect to Energize and report information to it.


This implementation is far from being complete, but it does provide for using most of the capabilities of the Energize browsers with Modula-3 code: Language Element Browser, call graphs, object inheritance graphs, error messages annotated in the source code, edit definition or declaration, visit uses of language element, etc. The major features that are not supported are "incremental compilation" and "smart compilation". You do, however, get incremental linking, which can save a lot of time. Another obvious limitation of the current Energize release is that the browsers tend to display everything using C++ syntax and terminology.

Some additional details of the limitations of the current implementation:

There are probably many other bugs that have not yet been discovered. The modified compiler has been successfully used in its own development, but has had negligible testing beyond that.

If you find additional bugs, I would be interested in hearing about them, but any bug fixing will be strictly on the basis of "if and when I feel like it". Once again, this is not a supported product of Lucid, so the Lucid customer support folks won't be able to help you with this. If you would like to volunteer to help with fixing or extending the implementation, that would be most welcome. The modified compiler sources are available on request.

David N. Gray
Phone: 415 329-8400 x5529

Lucid, Inc.
707 Laurel Street
Menlo Park, CA 94025-3414

July 19, 1994