?? sec-compilation-time.html
字號:
<HTML
><HEAD
><TITLE
>Compilation-Time Tips</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.74b"><LINK
REL="HOME"
TITLE="Happy User Guide"
HREF="happy.html"><LINK
REL="UP"
TITLE="Tips"
HREF="sec-tips.html"><LINK
REL="PREVIOUS"
TITLE="Tips"
HREF="sec-tips.html"><LINK
REL="NEXT"
TITLE="Finding Type Errors"
HREF="sec-finding-errors.html"></HEAD
><BODY
CLASS="SECT1"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Happy User Guide</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sec-tips.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 6. Tips</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sec-finding-errors.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="SEC-COMPILATION-TIME"
>6.2. Compilation-Time Tips</A
></H1
><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
><P
></P
><UL
><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
><P
> Give type signatures for everything (see <A
HREF="sec-type-signatures.html"
>Section 2.4</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 <TT
CLASS="LITERAL"
>-g -a -c</TT
>
options when generating parsers to be compiled with GHC will
help considerably.</P
></LI
></UL
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sec-tips.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="happy.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sec-finding-errors.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Tips</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="sec-tips.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Finding Type Errors</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -