Running Miranda
The functional programming language
Miranda has an implementation running on one of the CS Linux workstations
(miranda.cs.uiowa.edu). This machine is not accessible from off-campus, so you
need to ssh to linux.cs.uiowa.edu, and from there ssh miranda.
Programs are composed in a text
file using the editor of your choice. The command to invoke the Miranda system
is: 'mira filename'. The filename in the command (if any) designates a text
file containing a Miranda program (or script as it’s called in Miranda). Note
that files containing Miranda scripts must have a name which ends with '.m'. Also, if the 'mira' command is
issued from another of the CS Linux workstations, a session on the miranda
machine is automatically initiated.
Assuming that a script compiles
successfully, the remainder of the session is a series of interactions with the
Miranda system. At each Miranda prompt you enter an arbitrary Miranda
expression whose constituent functions are defined in the script (or are
pre-defined), the result will be displayed, and the prompt for the next input
issued.
An entry with first character '/'
is regarded as a command rather than an expression to be evaluated. The following commands
(plus others) are available:
/quit - end Miranda
session
/help - display info
on the Miranda commands
/man - enter on-line
Miranda documentation subsystem
/edit - edit current
script (vi is default editor, can be reset to your choice)
/aux - print list of
auxiliary commands
Another command allows you to name
your default editor, and then you can switch between editing and executing your
program without stopping and restarting Miranda. There are various other types
of input permitted at the Miranda prompt and they are explained by the help
command.
Miranda has excellent,
comprehensive documentation available on-line (use the /man command after
starting Miranda), and /man entry 100 is a good place to start and is required
reading. The functions which are pre-defined are fully described in the
on-line manual (/man entry 28). The precise BNF syntax and related constraints
are given in /man entries 24, 25 & 26.
Note that to access the manual entries in Miranda you must set the following environment variables:
tcsh
bash
The directory /usr/lib/miralib/ex (on the Miranda machine) contains a collection of example Miran-a scripts — they are briefly described in the README file also in this directory. Examples that we’ll discuss in class will be placed in our class directory and will be closely oriented towards our uses of Miranda.