MacMindy

A Dylan Compiler "for the rest of us."

by Patrick C. Beard <beard@apple.com>


Introduction

MacMindy is a version of Carnegie Mellon's prototype Dylan compiler, Mindy, version 1.4. With MacMindy, you can create first-class Macintosh applications that make extensive use of the toolbox. This document covers the additional features provided by MacMindy. Full documentation for the Mindy language and libraries is available at:

http://legend.gwydion.cs.cmu.edu/gwydion/mindy/index.html.

Installation

Version 1.4 of MacMindy has been redesigned to work with Metrowerks' CodeWarrior version 7 (abbreviated CW7). Versions 1.4d4 and later support both PowerPC and 68K Macintosh development. To run MacMindy programs on 68K Macintoshes, you'll have to obtain CFM-68K, which can be obtained at:

http://www.opendoc.apple.com/cgi-bin/read-license?OD+CFM-68K.hqx.

Once you have installed CW7, and extracted the MacMindy distribution, open the folder "MacMindy 1.4 for CodeWarrior." Inside you will find a folder called "--> CodeWarrior Plugins." This contains the tools you will use to compile and link MacMindy programs. Place the contents of each folder in the corresponding folder within ":Metrowerks CodeWarrior:Code Warrior Plugins."

To allow the compiler to find the various bytecode libraries, you should also place the contents of the folder "--> MacOS Support" into the ":Metrowerks CodeWarrior:MacOS Support" folder.

After installing the MacMindy tools, you'll need to make an alias to the folder "Mindy Libraries" and move this alias to your "Extensions" folder within the "System Folder."

Installation is now complete.

Getting Started

Now that you have installed the compiler, you can get started by building some of the sample programs. Open the folder "hello" within ":MacMindy 1.4 for CodeWarrior:Examples." Open the project file, "hello.mu". Choose "Run" from the "Project" menu. The program will be recompiled, linked, and then will execute. A window will appear very much like figure 1.


Figure 1. Running the hello example

You should feel very proud. You have run your very first MacMindy program. Next, we will see how this program is constructed.

Under the Hood

Quit the program, and return to CodeWarrior. The project window will look like figure 2.


Figure 2. The hello project window

The project consists of two files, hello.dyl, and dylan.dlib. hello.dyl contains the source code, written in the Dylan language, for the program you just ran. Open it up. You will see the following program:

/*
  hello.dyl
 */

define method main (argv0, #rest args)
  puts("Hello, world!\n");
end;

This demonstrates the simplest MacMindy program. Execution starts in a function called main and finishes when main exits.

Configuring MacMindy

MacMindy supports two types of targets: libraries and applications. A library is simply a file that contains the results of compiling all of the source files contained in a single project. To configure MacMindy to create a library, choose "Preferences" from the CodeWarrior "Edit" menu. Select the icon entitled "MindyDylan." You will see the following dialog:

The pop-up menu "Project Type:" is used to set the type of result that the project will produce. The editable text item "Compile in Library:" is used to set the name of the library that the source code of a project will be compiled into.