<!-- 95% W3C COMPLIANT, 95% CSS FREE, RAW HTML --> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"> <title>BiglooA ``practical Scheme compiler''User manual for version 3.2bJune 2009</title> <style type="text/css"> <!-- pre { font-family: monospace } tt { font-family: monospace } code { font-family: monospace } p.flushright { text-align: right } p.flushleft { text-align: left } span.sc { font-variant: small-caps } span.sf { font-family: sans-serif } span.skribetitle { font-family: sans-serif; font-weight: bolder; font-size: x-large; } span.refscreen { } span.refprint { display: none; } --> </style> </head> <body class="chapter" bgcolor="#ffffff"> <table width="100%" class="skribetitle" cellspacing="0" cellpadding="0"><tbody> <tr><td align="center" bgcolor="#8381de"><div class="skribetitle"><strong><big><big><big>5. Bigloo<br/>A ``practical Scheme compiler''<br/>User manual for version 3.2b<br/>June 2009 -- DSSSL support</big></big></big></strong></div><center> </center> </td></tr></tbody></table> <table cellpadding="3" cellspacing="0" width="100%" class="skribe-margins"><tr> <td align="left" valign="top" class="skribe-left-margin" width="20%" bgcolor="#dedeff"><div class="skribe-left-margin"> <br/><center id='center26460' ><table width="97%" border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse;" frame="box" rules="none"><tbody> <tr bgcolor="#8381de"><th id="tc26450" align="center" colspan="1"><font color="#ffffff"><strong id='bold26448' >main page</strong></font></th></tr> <tr bgcolor="#ffffff"><td id="tc26457" align="center" colspan="1"><table width="100%" border="0" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc26453" align="left" valign="top" colspan="1"><strong id='bold26452' >top:</strong></td><td id="tc26454" align="right" valign="top" colspan="1"><a href="bigloo.html#Bigloo-A-``practical-Scheme-compiler''-User-manual-for-version-3.2b-June-2009" class="inbound">Bigloo<br/>A ``practical Scheme compiler''<br/>User manual for version 3.2b<br/>June 2009</a></td></tr> </tbody></table> </td></tr> </tbody></table> </center> <br/><br/><center id='center26470' ><table width="97%" border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse;" frame="box" rules="none"><tbody> <tr bgcolor="#8381de"><th id="tc26464" align="center" colspan="1"><font color="#ffffff"><strong id='bold26462' >DSSSL support</strong></font></th></tr> <tr bgcolor="#ffffff"><td id="tc26467" align="center" colspan="1"><table cellspacing="1" cellpadding="1" width="100%" class="toc"> <tbody> <tr><td valign="top" align="left">5.1</td><td colspan="4" width="100%"><a href="bigloo-6.html#DSSSL-formal-argument-lists">DSSSL formal argument lists</a></td></tr> <tr><td valign="top" align="left">5.2</td><td colspan="4" width="100%"><a href="bigloo-6.html#Modules-and-DSSSL-formal-argument-lists">Modules and DSSSL formal argument lists</a></td></tr> </tbody> </table> </td></tr> </tbody></table> </center> <br/><br/><center id='center26480' ><table width="97%" border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse;" frame="box" rules="none"><tbody> <tr bgcolor="#8381de"><th id="tc26474" align="center" colspan="1"><font color="#ffffff"><strong id='bold26472' >Chapters</strong></font></th></tr> <tr bgcolor="#ffffff"><td id="tc26477" align="center" colspan="1"><table cellspacing="1" cellpadding="1" width="100%" class="toc"> <tbody> <tr><td valign="top" align="left"></td><td colspan="4" width="100%"><a href="bigloo-1.html#Acknowledgements">Acknowledgements</a></td></tr> <tr><td valign="top" align="left">1</td><td colspan="4" width="100%"><a href="bigloo-2.html#Table-of-contents">Table of contents</a></td></tr> <tr><td valign="top" align="left">2</td><td colspan="4" width="100%"><a href="bigloo-3.html#Overview-of-Bigloo">Overview of Bigloo</a></td></tr> <tr><td valign="top" align="left">3</td><td colspan="4" width="100%"><a href="bigloo-4.html#Modules">Modules</a></td></tr> <tr><td valign="top" align="left">4</td><td colspan="4" width="100%"><a href="bigloo-5.html#Core-Language">Core Language</a></td></tr> <tr><td valign="top" align="left">5</td><td colspan="4" width="100%"><a href="bigloo-6.html#DSSSL-support">DSSSL support</a></td></tr> <tr><td valign="top" align="left">6</td><td colspan="4" width="100%"><a href="bigloo-7.html#Standard-Library">Standard Library</a></td></tr> <tr><td valign="top" align="left">7</td><td colspan="4" width="100%"><a href="bigloo-8.html#Pattern-Matching">Pattern Matching</a></td></tr> <tr><td valign="top" align="left">8</td><td colspan="4" width="100%"><a href="bigloo-9.html#Fast-search">Fast search</a></td></tr> <tr><td valign="top" align="left">9</td><td colspan="4" width="100%"><a href="bigloo-10.html#Structures-and-Records">Structures and Records</a></td></tr> <tr><td valign="top" align="left">10</td><td colspan="4" width="100%"><a href="bigloo-11.html#Object-System">Object System</a></td></tr> <tr><td valign="top" align="left">11</td><td colspan="4" width="100%"><a href="bigloo-12.html#Regular-parsing">Regular parsing</a></td></tr> <tr><td valign="top" align="left">12</td><td colspan="4" width="100%"><a href="bigloo-13.html#Lalr(1)-parsing">Lalr(1) parsing</a></td></tr> <tr><td valign="top" align="left">13</td><td colspan="4" width="100%"><a href="bigloo-14.html#Posix-Regular-Expressions">Posix Regular Expressions</a></td></tr> <tr><td valign="top" align="left">14</td><td colspan="4" width="100%"><a href="bigloo-15.html#Command-Line-Parsing">Command Line Parsing</a></td></tr> <tr><td valign="top" align="left">15</td><td colspan="4" width="100%"><a href="bigloo-16.html#Cryptography">Cryptography</a></td></tr> <tr><td valign="top" align="left">16</td><td colspan="4" width="100%"><a href="bigloo-17.html#Errors-Assertions-and-Traces">Errors, Assertions, and Traces</a></td></tr> <tr><td valign="top" align="left">17</td><td colspan="4" width="100%"><a href="bigloo-18.html#Threads">Threads</a></td></tr> <tr><td valign="top" align="left">18</td><td colspan="4" width="100%"><a href="bigloo-19.html#Database-library">Database library</a></td></tr> <tr><td valign="top" align="left">19</td><td colspan="4" width="100%"><a href="bigloo-20.html#Multimedia-library">Multimedia library</a></td></tr> <tr><td valign="top" align="left">20</td><td colspan="4" width="100%"><a href="bigloo-21.html#Mail-library">Mail library</a></td></tr> <tr><td valign="top" align="left">21</td><td colspan="4" width="100%"><a href="bigloo-22.html#Eval-and-code-interpretation">Eval and code interpretation</a></td></tr> <tr><td valign="top" align="left">22</td><td colspan="4" width="100%"><a href="bigloo-23.html#Macro-expansion">Macro expansion</a></td></tr> <tr><td valign="top" align="left">23</td><td colspan="4" width="100%"><a href="bigloo-24.html#Parameters">Parameters</a></td></tr> <tr><td valign="top" align="left">24</td><td colspan="4" width="100%"><a href="bigloo-25.html#Explicit-typing">Explicit typing</a></td></tr> <tr><td valign="top" align="left">25</td><td colspan="4" width="100%"><a href="bigloo-26.html#The-C-interface">The C interface</a></td></tr> <tr><td valign="top" align="left">26</td><td colspan="4" width="100%"><a href="bigloo-27.html#The-Java-interface">The Java interface</a></td></tr> <tr><td valign="top" align="left">27</td><td colspan="4" width="100%"><a href="bigloo-28.html#Bigloo-Libraries">Bigloo Libraries</a></td></tr> <tr><td valign="top" align="left">28</td><td colspan="4" width="100%"><a href="bigloo-29.html#Extending-the-Runtime-System">Extending the Runtime System</a></td></tr> <tr><td valign="top" align="left">29</td><td colspan="4" width="100%"><a href="bigloo-30.html#SRFIs">SRFIs</a></td></tr> <tr><td valign="top" align="left">30</td><td colspan="4" width="100%"><a href="bigloo-31.html#Compiler-description">Compiler description</a></td></tr> <tr><td valign="top" align="left">31</td><td colspan="4" width="100%"><a href="bigloo-32.html#User-Extensions">User Extensions</a></td></tr> <tr><td valign="top" align="left">32</td><td colspan="4" width="100%"><a href="bigloo-33.html#Bigloo-Development-Environment">Bigloo Development Environment</a></td></tr> <tr><td valign="top" align="left">33</td><td colspan="4" width="100%"><a href="bigloo-34.html#Global-Index">Global Index</a></td></tr> <tr><td valign="top" align="left">34</td><td colspan="4" width="100%"><a href="bigloo-35.html#Library-Index">Library Index</a></td></tr> <tr><td valign="top" align="left"></td><td colspan="4" width="100%"><a href="bigloo-36.html#Bibliography">Bibliography</a></td></tr> </tbody> </table> </td></tr> </tbody></table> </center> </div></td> <td align="left" valign="top" class="skribe-body"><div class="skribe-body"> <a name="DSSSL-Support" class="mark"></a><a name="g2384" class="mark"></a> Bigloo supports extensions for the <span class="sc">Dsssl</span> expression language [Dsssl96]:<br/><br/><ul class="itemize" id='itemize2395' ><li>Keywords. Bigloo supports full Dsssl keywords. </li> <li>Named constants. Bigloo implements the three <span class="sc">Dsssl</span> named constants: <code id='code2390' >#!optional</code>, <code id='code2391' >#!rest</code> and <code id='code2392' >#!key</code>. </li> <li>Dsssl formal argument lists. </li> </ul> <!-- DSSSL formal argument lists --> <a name="DSSSL-formal-argument-lists"></a> <div class="section-atitle"><table width="100%"><tr><td bgcolor="#dedeff"><h3><font color="black">5.1 DSSSL formal argument lists</font> </h3></td></tr></table> </div><div class="section"> <a name="g2396" class="mark"></a> <span class="sc">Dsssl</span> formal argument lists are defined by the following grammar:<br/><br/><center id='center2412' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ccccff"><pre class="prog" id='prog2410' ><formal-argument-list> ==> <required-formal-argument>* [<code id='code2400' >(#!optional</code> <optional-formal-argument>*<code id='code2401' >)</code>] [<code id='code2402' >(#!rest</code> <rest-formal-argument><code id='code2403' >)</code>] [<code id='code2404' >(#!key</code> <key-formal-argument>*<code id='code2405' >)</code>] <required-formal-argument> ==> <ieee-ident> <optional-formal-argument> ==> <ieee-ident> | <code id='code2406' >(</code><ieee-ident> <initializer><code id='code2407' >)</code> <rest-formal-argument> ==> <ieee-ident> <key-formal-argument> ==> <ieee-ident> | <code id='code2408' >(</code><ieee-ident> <initializer><code id='code2409' >)</code> <initializer> ==> <expr> </pre> </td></tr> </tbody></table></center> When a procedure is applied to a list of actual arguments, the formal and actual arguments are processed from left to right as follows:<br/><br/><ul class="itemize" id='itemize2442' ><li><em id='emph2414' >Variables</em> in <em id='emph2415' >required-formal-arguments</em> are bound to successive actual arguments starting with the first actual argument. It shall be an error if there are fewer actual arguments than <em id='emph2416' >required-formal-arguments</em>.<br/><br/></li> <li>Next, <em id='emph2419' >variables</em> in <em id='emph2420' >optional-formal-arguments</em> are bound to any remaining actual arguments. If there are fewer remaining actual arguments than <em id='emph2421' >optional-formal-arguments</em>, then variables are bound to the result of the evaluation of <em id='emph2422' >initializer</em>, if one was specified, and otherwise to <code id='code2423' >#f</code>. The <em id='emph2424' >initializer</em> is evaluated in an environment in which all previous optional formal arguments have been bound.<br/><br/></li> <li>If there is a <em id='emph2427' >rest-formal-argument</em>, then it is bound to a list of all remaining actual arguments. The remaining actual arguments are also eligible to be bound to <em id='emph2428' >keyword-formal-arguments</em>. If there is no <em id='emph2429' >rest-formal-argument</em> and there are no <em id='emph2430' >keyword-formal-arguments</em>, the it shall be an error if there are any remaining actual arguments.<br/><br/></li> <li>If <code id='code2433' >#!key</code> was specified in the <em id='emph2434' >formal-argument-list</em>, there shall be an even number of remaining actual arguments. These are interpreted as a series of pairs, where the first member of each pair is a keyword specifying the argument name, and the second is the corresponding value. It shall be an error if the first member of a pair is not a keyword. It shall be an error if the argument name is not the same as a variable in a <em id='emph2435' >keyword-formal-argument</em>, unless there is a <em id='emph2436' >rest-formal-argument</em>. If the same argument name occurs more than once in the list of actual arguments, then the first value is used. If there is no actual argument for a particular <em id='emph2437' >keyword-formal-argument</em>, then the variable is bound to the result of evaluating <em id='emph2438' >initializer</em> if one was specified, and otherwise <code id='code2439' >#f</code>. The <em id='emph2440' >initializer</em> is evaluated in an environment in which all previous formal key arguments have been bound. </li> </ul><br/><br/>It shall be an error for an <ieee-ident> to appear more than once in a <em id='emph2444' >formal-argument-list</em>.<br/><br/>Example:<br/><br/><center id='center2452' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog2450' >((<strong id='bold26481' >lambda</strong> (x y) x) 3 4 5 6) =>(3 4 5 6) ((<strong id='bold26482' >lambda</strong> (x y #!rest z) z) 3 4 5 6) => (5 6) ((<strong id='bold26483' >lambda</strong> (x y #!optional z #!rest r #!key i (j 1)) (list x y z i: i j: j)) 3 4 5 i: 6 i: 7) => (3 4 5 i: 6 j: 1) </pre> </td></tr> </tbody></table></center> </div><br> <!-- Modules and DSSSL formal argument lists --> <a name="Modules-and-DSSSL-formal-argument-lists"></a> <div class="section-atitle"><table width="100%"><tr><td bgcolor="#dedeff"><h3><font color="black">5.2 Modules and DSSSL formal argument lists</font> </h3></td></tr></table> </div><div class="section"> <a name="g2453" class="mark"></a> Functions using <span class="sc">Dsssl</span> formal argument lists can be exported or imported in the same way as all regular Bigloo functions. When exporting such a Dsssl function the exact prototype of the function must be duplicated in the export clause. That is, for instance, the exportation prototype for the function:<br/><br/><center id='center2460' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog2458' >(<font color="#6959cf"><strong id='bold26484' >define</strong></font> (<font color="#6959cf"><strong id='bold26486' >foo</strong></font> x y #!optional z #!key i (j 1)) ...) </pre> </td></tr> </tbody></table></center> is:<br/><br/><center id='center2466' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog2464' >(<font color="#1919af"><strong id='bold26488' >export</strong></font> (<font color="#1919af"><strong id='bold26490' >foo</strong></font> x y #!optional z #!key i (j 1))) </pre> </td></tr> </tbody></table></center> <br/><br/><br/> </div><br> </div></td> </tr></table><div class="skribe-ending"> <hr> <p class="ending" id='paragraph26497' ><font size="-1"> This <span class="sc">Html</span> page has been produced by <a href="http://www.inria.fr/mimosa/fp/Skribe" class="http">Skribe</a>. <br/> Last update <em id='it26495' >Tue Jun 2 11:43:26 2009</em>.</font></p></div> </body> </html>