<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta name="robots" content="index,nofollow"> <title>Enscript - MLton Standard ML Compiler (SML Compiler)</title> <link rel="stylesheet" type="text/css" charset="iso-8859-1" media="all" href="common.css"> <link rel="stylesheet" type="text/css" charset="iso-8859-1" media="screen" href="screen.css"> <link rel="stylesheet" type="text/css" charset="iso-8859-1" media="print" href="print.css"> <link rel="Start" href="Home"> </head> <body lang="en" dir="ltr"> <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct = "UA-833377-1"; urchinTracker(); </script> <table bgcolor = lightblue cellspacing = 0 style = "border: 0px;" width = 100%> <tr> <td style = " border: 0px; color: darkblue; font-size: 150%; text-align: left;"> <a class = mltona href="Home">MLton MLTONWIKIVERSION</a> <td style = " border: 0px; font-size: 150%; text-align: center; width: 50%;"> Enscript <td style = " border: 0px; text-align: right;"> <table cellspacing = 0 style = "border: 0px"> <tr style = "vertical-align: middle;"> </table> <tr style = "background-color: white;"> <td colspan = 3 style = " border: 0px; font-size:70%; text-align: right;"> <a href = "Home">Home</a> <a href = "TitleIndex">Index</a> </table> <div id="content" lang="en" dir="ltr"> <a class="external" href="http://people.ssh.com/mtr/genscript"><img src="moin-www.png" alt="[WWW]" height="11" width="11">GNU Enscript</a> converts ASCII files to PostScript, HTML, and other output languages, applying language sensitive highlighting (similar to <a href="Emacs">Emacs</a>'s font lock mode). Here are a few <em>states</em> files for highlighting <a href="StandardML"> Standard ML</a>. <ul> <li> <p> <a href = "http://mlton.org/cgi-bin/viewsvn.cgi/mlton/tags/on-MLTONWIKIVERSION-release/ide/enscript/sml_simple.st?view=markup"><img src="moin-www.png" alt="[WWW]" height="11" width="11">sml_simple.st</a> -- Provides highlighting of keywords, string and character constants, and (nested) comments. <pre class=code> <I><FONT COLOR="#B22222">(* Comments (* can be nested *) *)</FONT></I> <B><FONT COLOR="#A020F0">structure</FONT></B> S = <B><FONT COLOR="#A020F0">struct</FONT></B> <B><FONT COLOR="#A020F0">val</FONT></B> x = (1, 2, <B><FONT COLOR="#BC8F8F">"three"</FONT></B>) <B><FONT COLOR="#A020F0">end</FONT></B> </PRE> </p> </li> <li class="gap"> <p> <a href = "http://mlton.org/cgi-bin/viewsvn.cgi/mlton/tags/on-MLTONWIKIVERSION-release/ide/enscript/sml_verbose.st?view=markup"><img src="moin-www.png" alt="[WWW]" height="11" width="11">sml_verbose.st</a> -- Supersedes the above, adding highlighting of numeric constants. Due to the limited parsing available, numeric record labels are highlighted as numeric constants, in all contexts. Likewise, a binding precedence separated from <tt>infix</tt> or <tt>infixr</tt> by a newline is highlighted as a numeric constant and a numeric record label selector separated from <tt>#</tt> by a newline is highlighted as a numeric constant. </p> <pre class=code> <B><FONT COLOR="#A020F0">structure</FONT></B> S = <B><FONT COLOR="#A020F0">struct</FONT></B> <I><FONT COLOR="#B22222">(* These look good *)</FONT></I> <B><FONT COLOR="#A020F0">val</FONT></B> x = (<B><FONT COLOR="#5F9EA0">1</FONT></B>, <B><FONT COLOR="#5F9EA0">2</FONT></B>, <B><FONT COLOR="#BC8F8F">"three"</FONT></B>) <B><FONT COLOR="#A020F0">val</FONT></B> z = #2 x <I><FONT COLOR="#B22222">(* Although these look bad (not all the numbers are constants), * * they never occur in practice, as they are equivalent to the above. *)</FONT></I> <B><FONT COLOR="#A020F0">val</FONT></B> x = {<B><FONT COLOR="#5F9EA0">1</FONT></B> = <B><FONT COLOR="#5F9EA0">1</FONT></B>, <B><FONT COLOR="#5F9EA0">3</FONT></B> = <B><FONT COLOR="#BC8F8F">"three"</FONT></B>, <B><FONT COLOR="#5F9EA0">2</FONT></B> = <B><FONT COLOR="#5F9EA0">2</FONT></B>} <B><FONT COLOR="#A020F0">val</FONT></B> z = # <B><FONT COLOR="#5F9EA0">2</FONT></B> x <B><FONT COLOR="#A020F0">end</FONT></B> </PRE> <p> </p> </li> <li class="gap"> <p> <a href = "http://mlton.org/cgi-bin/viewsvn.cgi/mlton/tags/on-MLTONWIKIVERSION-release/ide/enscript/sml_fancy.st?view=markup"><img src="moin-www.png" alt="[WWW]" height="11" width="11">sml_fancy.st</a> -- Supersedes the above, adding highlighting of type and constructor bindings, highlighting of explicit binding of type variables at <tt>val</tt> and <tt>fun</tt> declarations, and separate highlighting of core and modules level keywords. Due to the limited parsing available, it is assumed that the input is a syntactically correct, top-level declaration. <pre class=code> <B><FONT COLOR="#0000FF">structure</FONT></B> S = <B><FONT COLOR="#0000FF">struct</FONT></B> <B><FONT COLOR="#A020F0">val</FONT></B> x = (<B><FONT COLOR="#5F9EA0">1</FONT></B>, <B><FONT COLOR="#5F9EA0">2</FONT></B>, <B><FONT COLOR="#BC8F8F">"three"</FONT></B>) <B><FONT COLOR="#A020F0">datatype</FONT></B><B><FONT COLOR="#228B22"> 'a t </FONT></B>=<B><FONT COLOR="#228B22"> <FONT COLOR="#B8860B">T</FONT> <B><FONT COLOR="#A020F0">of</FONT></B> 'a </FONT></B><B><FONT COLOR="#A020F0">and</FONT></B><B><FONT COLOR="#228B22"> u </FONT></B>=<B><FONT COLOR="#228B22"> <FONT COLOR="#B8860B">U</FONT> <B><FONT COLOR="#A020F0">of</FONT></B> v * v </FONT></B><B><FONT COLOR="#A020F0">withtype</FONT></B><B><FONT COLOR="#228B22"> v </FONT></B>=<B><FONT COLOR="#228B22"> {left: int t, right: int t} </FONT></B><B><FONT COLOR="#A020F0">exception</FONT></B><B><FONT COLOR="#228B22"> <FONT COLOR="#B8860B">E1</FONT> <B><FONT COLOR="#A020F0">of</FONT></B> int </FONT></B><B><FONT COLOR="#A020F0">and</FONT></B><B><FONT COLOR="#228B22"> <FONT COLOR="#B8860B">E2</FONT> </FONT></B><B><FONT COLOR="#A020F0">fun</FONT></B> <B><FONT COLOR="#228B22">'a</FONT></B> id (x: 'a) : 'a = x <I><FONT COLOR="#B22222">(* Although this looks bad (the explicitly bound type variable 'a is * * not highlighted), it is unlikely to occur in practice. *)</FONT></I> <B><FONT COLOR="#A020F0">val</FONT></B> 'a id = <B><FONT COLOR="#A020F0">fn</FONT></B> (x : 'a) => x <B><FONT COLOR="#0000FF">end</FONT></B> </PRE> </p> </li> <li class="gap"> <p> <a href = "http://mlton.org/cgi-bin/viewsvn.cgi/mlton/tags/on-MLTONWIKIVERSION-release/ide/enscript/sml_gaudy.st?view=markup"><img src="moin-www.png" alt="[WWW]" height="11" width="11">sml_gaudy.st</a> -- Supersedes the above, adding highlighting of type annotations, in both expressions and signatures. Due to the limited parsing available, it is assumed that the input is a syntactically correct, top-level declaration. <pre class=code> <B><FONT COLOR="#0000FF">signature</FONT></B> S = <B><FONT COLOR="#0000FF">sig</FONT></B> <B><FONT COLOR="#A020F0">type</FONT></B><B><FONT COLOR="#228B22"> t </FONT></B><B><FONT COLOR="#A020F0">val</FONT></B> x :<B><FONT COLOR="#228B22"> t </FONT></B><B><FONT COLOR="#A020F0">val</FONT></B> f :<B><FONT COLOR="#228B22"> t * int -> int </FONT></B><B><FONT COLOR="#0000FF">end</FONT></B> <B><FONT COLOR="#0000FF">structure</FONT></B> S : S = <B><FONT COLOR="#0000FF">struct</FONT></B> <B><FONT COLOR="#A020F0">datatype</FONT></B><B><FONT COLOR="#228B22"> t </FONT></B>=<B><FONT COLOR="#228B22"> <FONT COLOR="#B8860B">T</FONT> <B><FONT COLOR="#A020F0">of</FONT></B> int </FONT></B><B><FONT COLOR="#A020F0">val</FONT></B> x :<B><FONT COLOR="#228B22"> t </FONT></B>=<B><FONT COLOR="#228B22"></FONT></B> T <B><FONT COLOR="#5F9EA0">0</FONT></B> <B><FONT COLOR="#A020F0">fun</FONT></B> f (T x, i :<B><FONT COLOR="#228B22"> int</FONT></B>) :<B><FONT COLOR="#228B22"> int </FONT></B>=<B><FONT COLOR="#228B22"></FONT></B> x + y <B><FONT COLOR="#A020F0">fun</FONT></B> <B><FONT COLOR="#228B22">'a</FONT></B> id (x:<B><FONT COLOR="#228B22"> 'a</FONT></B>) :<B><FONT COLOR="#228B22"> 'a </FONT></B>=<B><FONT COLOR="#228B22"></FONT></B> x <B><FONT COLOR="#0000FF">end</FONT></B> </PRE> </p> </li> </ul> <h2 id="head-e5a1ef08918738578c7f1b88920c73a60499c69d">Install and use</h2> <ul> <li> <p> Version 1.6.3 of <a class="external" href="http://people.ssh.com/mtr/genscript"><img src="moin-www.png" alt="[WWW]" height="11" width="11">GNU Enscript</a> </p> </li> <ul> <li> <p> Copy all files to <tt>/usr/share/enscript/hl/</tt> or <tt>.enscript/</tt> in your home directory. </p> </li> <li> <p> Invoke <tt>enscript</tt> with <tt>--highlight=sml_simple</tt> (or <tt>--highlight=sml_verbose</tt> or <tt>--highlight=sml_fancy</tt> or <tt>--highlight=sml_gaudy</tt>). </p> </li> </ul> <li> <p> Version 1.6.1 of <a class="external" href="http://people.ssh.com/mtr/genscript"><img src="moin-www.png" alt="[WWW]" height="11" width="11">GNU Enscript</a> </p> </li> <ul> <li> <p> Append <a href = "http://mlton.org/cgi-bin/viewsvn.cgi/mlton/tags/on-MLTONWIKIVERSION-release/ide/enscript/sml_all.st?view=markup"><img src="moin-www.png" alt="[WWW]" height="11" width="11">sml_all.st</a> to <tt>/usr/share/enscript/enscript.st</tt> </p> </li> <li> <p> Invoke <tt>enscript</tt> with <tt>--pretty-print=sml_simple</tt> (or <tt>--pretty-print=sml_verbose</tt> or <tt>--pretty-print=sml_fancy</tt> or <tt>--pretty-print=sml_gaudy</tt>). </p> </li> </ul> </ul> <p> This <a href="WebSite">WebSite</a> uses <tt>sml_fancy</tt> to pretty-print <a href="StandardML">Standard ML</a> source code. Comments and suggestions should be directed to <a href="MatthewFluet">MatthewFluet</a>. </p> </div> <p> <hr> Last edited on 2006-11-02 17:41:43 by <span title="76.16.241.4"><a href="MatthewFluet">MatthewFluet</a></span>. </body></html>