| 1 |
What is in this directory |
| 2 |
------------------------ |
| 3 |
This directory contains the source to 'nowhere'. |
| 4 |
This is a simple source to source translation tool that expands out |
| 5 |
case expressions with conditional patterns. |
| 6 |
Conditional patterns use the "where" keyword. For example: |
| 7 |
|
| 8 |
case l of |
| 9 |
[x,y,z] where x=1 => 1 |
| 10 |
| _ => 2 |
| 11 |
|
| 12 |
means the same as: |
| 13 |
|
| 14 |
case l of |
| 15 |
[1,y,z] => 1 |
| 16 |
| _ => 2 |
| 17 |
|
| 18 |
Currently, the input file must be of the following form: |
| 19 |
|
| 20 |
local |
| 21 |
<definitions> |
| 22 |
in |
| 23 |
<body> |
| 24 |
end |
| 25 |
|
| 26 |
<definitions> should include all datatypes definitions that are used inside the |
| 27 |
<body>. It is only for the tool's benefit and does not appear in the output. |
| 28 |
Only <body> appears at the output. You can use the special declaration |
| 29 |
|
| 30 |
include "filename" |
| 31 |
|
| 32 |
to import extra definitions. |
| 33 |
|
| 34 |
The tool translates all case expressions with guards into the appropriate code. |
| 35 |
How to compile the tool |
| 36 |
----------------------- |
| 37 |
|
| 38 |
In sml (version 110.30+), type |
| 39 |
|
| 40 |
use "build.sml" |
| 41 |
|
| 42 |
This will create an image named: |
| 43 |
|
| 44 |
nowhere.<arch> |
| 45 |
|
| 46 |
How to run it |
| 47 |
------------- |
| 48 |
|
| 49 |
To run it, type: |
| 50 |
|
| 51 |
sml @SMLload=nowhere infile |
| 52 |
|
| 53 |
on the Unix command line |
| 54 |
|
| 55 |
The output will be written to a file with suffix 'sml'. |
| 56 |
The input file should have a different suffix. |
| 57 |
|