Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 8de1f55ea6a1a64d0f3f3ea116288458 > files > 93

happy-1.17-3mdv2009.0.i586.rpm

<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>8.2. Compilation-Time Tips</title><link rel="stylesheet" href="fptools.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" href="index.html" title="Happy User Guide"><link rel="up" href="sec-tips.html" title="Chapter 8. Tips"><link rel="prev" href="sec-tips.html" title="Chapter 8. Tips"><link rel="next" href="sec-finding-errors.html" title="8.3. Finding Type Errors"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">8.2. Compilation-Time Tips</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="sec-tips.html">Prev</a> </td><th width="60%" align="center">Chapter 8. Tips</th><td width="20%" align="right"> <a accesskey="n" href="sec-finding-errors.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sec-compilation-time"></a>8.2. Compilation-Time Tips</h2></div></div></div><p>We have found that compiling parsers generated by
      <span class="application">Happy</span> can take a large amount of time/memory, so
      here's some tips on making things more sensible:</p><div class="itemizedlist"><ul type="disc"><li><p> Include as little code as possible in the module
          trailer.  This code is included verbatim in the generated
          parser, so if any of it can go in a separate module, do
          so.</p></li><li><a class="indexterm" name="id2551127"></a><p> Give type signatures for everything (see <a class="xref" href="sec-type-signatures.html" title="2.4. Type Signatures">Section 2.4, &#8220;Type Signatures&#8221;</a>.  This is reported to improve
          things by about 50%.  If there is a type signature for every
          single non-terminal in the grammar, then <span class="application">Happy</span>
          automatically generates type signatures for most functions
          in the parser.</p></li><li><p> Simplify the grammar as much as possible (applies to
          everything, this one).</p></li><li><p> Use a recent version of GHC.  Versions from 4.04
	  onwards have lower memory requirements for compiling
	  <span class="application">Happy</span>-generated parsers.</p></li><li><p> Using <span class="application">Happy</span>'s <code class="literal">-g -a -c</code>
	  options when generating parsers to be compiled with GHC will
	  help considerably.</p></li></ul></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sec-tips.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="sec-tips.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sec-finding-errors.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 8. Tips </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 8.3. Finding Type Errors</td></tr></table></div></body></html>