| 1 |
<html><head> |
| 2 |
|
| 3 |
<title>SAL</title> |
| 4 |
|
| 5 |
<style type="text/css"> |
| 6 |
.example { |
| 7 |
color: #000000; |
| 8 |
background-color: #F5F5F5; |
| 9 |
padding: 8px; |
| 10 |
border: #808080; |
| 11 |
border-style: solid; |
| 12 |
border-width: 1px; |
| 13 |
width:auto; |
| 14 |
} |
| 15 |
.button { |
| 16 |
color: #000000; |
| 17 |
background-color: #F5F5F5; |
| 18 |
padding-top: 1px; |
| 19 |
padding-bottom: 1px; |
| 20 |
padding-left: 4px; |
| 21 |
padding-right: 8px; |
| 22 |
border: #808080; |
| 23 |
border-style: solid; |
| 24 |
border-width: 1px; |
| 25 |
white-space: pre; |
| 26 |
} |
| 27 |
.box { |
| 28 |
color: #000000; |
| 29 |
padding-top: 4px; |
| 30 |
padding-bottom: 4px; |
| 31 |
padding-left: 16px; |
| 32 |
padding-right: 16px; |
| 33 |
border: #808080; |
| 34 |
border-style: solid; |
| 35 |
border-width: 1px; |
| 36 |
} |
| 37 |
</style> |
| 38 |
|
| 39 |
</head> |
| 40 |
|
| 41 |
<body> |
| 42 |
|
| 43 |
<a href="xlisp-man-index.htm">XLISP</a> |
| 44 |
|
| 45 |
<hr> |
| 46 |
|
| 47 |
<h1>SAL</h1> |
| 48 |
|
| 49 |
<hr> |
| 50 |
|
| 51 |
<h2>Data Types</h2> |
| 52 |
|
| 53 |
<hr> |
| 54 |
|
| 55 |
<p>Data types used in SAL and XLISP:</p> |
| 56 |
|
| 57 |
<p><table cellpadding="0" cellspacing="2"><tbody> |
| 58 |
<tr> |
| 59 |
<td><nobr><code> </code></nobr></td> |
| 60 |
<td colspan="2"></td> |
| 61 |
<td align="center" colspan="2">SAL</td> |
| 62 |
<td align="center" colspan="2">XLISP</td> |
| 63 |
</tr> |
| 64 |
<tr> |
| 65 |
<td><nobr><code> </code></nobr></td> |
| 66 |
<td align="right"><nobr>integer:</nobr></td> |
| 67 |
<td><nobr> </nobr></td> |
| 68 |
<td align="center" class="button" colspan="2"><nobr><code>1</code></nobr></td> |
| 69 |
<td align="center" class="button" colspan="2"><nobr><code>1</code></nobr></td> |
| 70 |
</tr> |
| 71 |
<tr> |
| 72 |
<td><nobr><code> </code></nobr></td> |
| 73 |
<td align="right"><nobr>float:</nobr></td> |
| 74 |
<td><nobr> </nobr></td> |
| 75 |
<td align="center" class="button" colspan="2"><nobr><code>1.0</code></nobr></td> |
| 76 |
<td align="center" class="button" colspan="2"><nobr><code>1.0</code></nobr></td> |
| 77 |
</tr> |
| 78 |
<tr> |
| 79 |
<td><nobr><code> </code></nobr></td> |
| 80 |
<td align="right"><nobr>string:</nobr></td> |
| 81 |
<td><nobr> </nobr></td> |
| 82 |
<td align="center" class="button" colspan="2"><nobr><code>"hello"</code></nobr></td> |
| 83 |
<td align="center" class="button" colspan="2"><nobr><code>"hello"</code></nobr></td> |
| 84 |
</tr> |
| 85 |
<tr> |
| 86 |
<td><nobr><code> </code></nobr></td> |
| 87 |
<td align="right"><nobr>symbol:</nobr></td> |
| 88 |
<td><nobr> </nobr></td> |
| 89 |
<td align="center" class="button" colspan="2"><nobr><code><font color="#0000CC">name</font></code></nobr></td> |
| 90 |
<td align="center" class="button" colspan="2"><nobr><code><font color="#0000CC">name</font></code></nobr></td> |
| 91 |
</tr> |
| 92 |
<tr> |
| 93 |
<td><nobr><code> </code></nobr></td> |
| 94 |
<td align="right"><nobr>keyword:</nobr></td> |
| 95 |
<td><nobr> </nobr></td> |
| 96 |
<td align="center" class="button" colspan="2"><nobr><code><font color="#0000CC">symbol</font>:</code></nobr></td> |
| 97 |
<td align="center" class="button" colspan="2"><nobr><code>:<font color="#0000CC">symbol</font></code></nobr></td> |
| 98 |
</tr> |
| 99 |
<tr> |
| 100 |
<td><nobr><code> </code></nobr></td> |
| 101 |
<td align="right"><nobr>list:</nobr></td> |
| 102 |
<td><nobr> </nobr></td> |
| 103 |
<td align="center" class="button" colspan="2"><nobr><code>{<font color="#0000CC">item-1 item-2</font> ...}</code></nobr></td> |
| 104 |
<td align="center" class="button" colspan="2"><nobr><code>(<font color="#0000CC">item-1 item-2</font> ...)</code></nobr></td> |
| 105 |
</tr> |
| 106 |
<tr> |
| 107 |
<td><nobr><code> </code></nobr></td> |
| 108 |
<td align="right"><nobr>array:</nobr></td> |
| 109 |
<td><nobr> </nobr></td> |
| 110 |
<td align="center" class="button" colspan="2"><nobr><code><font color="#0000CC">array</font>[<font color="#0000CC">index</font>]</code></nobr></td> |
| 111 |
<td align="center" class="button" colspan="2"><nobr><code>(aref <font color="#0000CC">array index</font>)</code></nobr></td> |
| 112 |
</tr> |
| 113 |
<tr> |
| 114 |
<td><nobr><code> </code></nobr></td> |
| 115 |
<td align="right"><nobr>boolean:</nobr></td> |
| 116 |
<td><nobr> </nobr></td> |
| 117 |
<td align="center" class="button"><nobr><code><font color="#008844">#t</font></code></nobr></td> |
| 118 |
<td align="center" class="button"><nobr><code><font color="#AA0000">#f</font></code></nobr></td> |
| 119 |
<td align="center" class="button"><nobr><code> <font color="#008844">t</font> </code></nobr></td> |
| 120 |
<td align="center" class="button"><nobr><code><font color="#AA0000">nil</font></code></nobr></td> |
| 121 |
</tr> |
| 122 |
</tbody></table></p> |
| 123 |
|
| 124 |
<p>Data types with different concepts:</p> |
| 125 |
|
| 126 |
<p>SAL:</p> |
| 127 |
|
| 128 |
<ul> |
| 129 |
<li>expressions - evaluated to produce a return value</li> |
| 130 |
<li>statements - evaluated for side-effects</li> |
| 131 |
</ul> |
| 132 |
|
| 133 |
<p>XLISP:</p> |
| 134 |
|
| 135 |
<ul> |
| 136 |
<li>character - a single ASCII character</li> |
| 137 |
<li>object - the XLISP object system</li> |
| 138 |
<li>stream - data type of unknown length</li> |
| 139 |
<li>subr - built-in function</li> |
| 140 |
<li>fsubr - special form</li> |
| 141 |
<li>closure - user defined function</li> |
| 142 |
</ul> |
| 143 |
|
| 144 |
<p>A function to print the Lisp code, produced by the SAL compiler, to the |
| 145 |
screen:</p> |
| 146 |
|
| 147 |
<pre class="example"> |
| 148 |
(defun <font color="#0000CC">test</font> (string) |
| 149 |
(if (not (stringp string)) |
| 150 |
(error "not a string" string) |
| 151 |
(pprint (third (second (sal-compile string nil nil "<console>")))))) |
| 152 |
</pre> |
| 153 |
|
| 154 |
<p><nobr> <a href="#top">Back to top</a></nobr></p> |
| 155 |
|
| 156 |
<hr> |
| 157 |
|
| 158 |
<br> |
| 159 |
|
| 160 |
</body></html> |