<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> <!-- Copyright C 2011 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with the Invariant Sections being "Funding Free Software", the Front-Cover Texts being (a) (see below), and with the Back-Cover Texts being (b) (see below). A copy of the license is included in the section entitled "GNU Free Documentation License". (a) The FSF's Front-Cover Text is: A GNU Manual (b) The FSF's Back-Cover Text is: You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development. --> <!-- Created on September 27, 2011 by texi2html 1.82 texi2html was written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> Olaf Bachmann <obachman@mathematik.uni-kl.de> and many others. Maintained by: Many creative people. Send bugs and suggestions to <texi2html-bug@nongnu.org> --> <head> <title>MELT plugin documentation</title> <meta name="description" content="MELT plugin documentation"> <meta name="keywords" content="MELT plugin documentation"> <meta name="resource-type" content="document"> <meta name="distribution" content="global"> <meta name="Generator" content="texi2html 1.82"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <style type="text/css"> <!-- a.summary-letter {text-decoration: none} blockquote.smallquotation {font-size: smaller} pre.display {font-family: serif} pre.format {font-family: serif} pre.menu-comment {font-family: serif} pre.menu-preformatted {font-family: serif} pre.smalldisplay {font-family: serif; font-size: smaller} pre.smallexample {font-size: smaller} pre.smallformat {font-family: serif; font-size: smaller} pre.smalllisp {font-size: smaller} span.roman {font-family:serif; font-weight:normal;} span.sansserif {font-family:sans-serif; font-weight:normal;} ul.toc {list-style: none} --> </style> </head> <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> <p>This file documents the MELT plugin for GCC. <br> </p><p>Copyright © 2011 Free Software Foundation, Inc. </p> <p>Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with the Invariant Sections being “Funding Free Software”, the Front-Cover Texts being (a) (see below), and with the Back-Cover Texts being (b) (see below). A copy of the license is included in the section entitled “GNU Free Documentation License”. </p> <p>(a) The FSF’s Front-Cover Text is: </p> <p> A GNU Manual </p> <p>(b) The FSF’s Back-Cover Text is: </p> <p> You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development. </p><br> <a name="Top"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="Introduction"></a> <h1 class="settitle">Introduction</h1> <a name="index-introduction"></a> <p>This manual documents briefly how to use the MELT plugin for GCC. The use of the GNU compilers is documented in a separate manual. See <a href="gcc.html#Top">(gcc)Top</a> section ‘Introduction’ in <cite>Using the GNU Compiler Collection (GCC)</cite>. The MELT plugin for GCC permits you to develop your specific extensions of GCC in a powerful, lispy, domain specific language (also called MELT). </p> <p>This manual is mainly a reference manual rather than a tutorial. It discusses how to use the MELT plugin for GCC. Additional tutorial information for GCC is linked to from <a href="http://gcc.gnu.org/readings.html">http://gcc.gnu.org/readings.html</a> and for MELT is linked to from <a href="http://gcc-melt.org/">http://gcc-melt.org/</a>. </p> <p>MELT documentation is made of a human written docuemtation (this document) and of a machine generated documentation. The machine generated documentation explains the MELT definitions (of functions, classes, selectors, primitives, etc...). Since it is generated from a GPLv3 source code, that generated documentation is released separately under a GPLv3 license. (the main author of this document, Basile Starynkevitch, understands that GPL and GFDL licenses are incompatible, so merging these two documentations is inappropriate.). </p> <table class="menu" border="0" cellspacing="0"> <tr><td align="left" valign="top"><a href="#MELT">1. MELT: Middle End Lisp Translator</a></td><td> </td><td align="left" valign="top"> the Middle End Lisp Translator. </td></tr> <tr><td align="left" valign="top"><a href="#Funding">Funding Free Software</a></td><td> </td><td align="left" valign="top"> How to help assure funding for free software. </td></tr> <tr><td align="left" valign="top"><a href="#GNU-Project">The GNU Project and GNU/Linux</a></td><td> </td><td align="left" valign="top"></td></tr> <tr><td align="left" valign="top"><a href="#Copying">GNU General Public License</a></td><td> </td><td align="left" valign="top"> GNU General Public License says how you can copy and share GCC. </td></tr> <tr><td align="left" valign="top"><a href="#GNU-Free-Documentation-License">GNU Free Documentation License</a></td><td> </td><td align="left" valign="top"> How you can copy and share this manual. </td></tr> <tr><td align="left" valign="top"><a href="#MELT-Option-Index">MELT Option Index</a></td><td> </td><td align="left" valign="top"> Index to MELT plugin command line options. </td></tr> <tr><td align="left" valign="top"><a href="#MELT-Concept-Index">MELT Concept Index</a></td><td> </td><td align="left" valign="top"> Index of MELT concepts and symbol names. </td></tr> </table> <hr size="1"> <a name="MELT"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Top" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#MELT-Prerequisites" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="MELT_003a-Middle-End-Lisp-Translator"></a> <h1 class="chapter">1. MELT: Middle End Lisp Translator</h1> <a name="index-MELT"></a> <a name="index-Middle-End-Lisp-Translator"></a> <p>The MELT branch introduces a powerful Lisp dialect to express middle-end analyzers and passes. This chapter describes the dialect and how to use it. A working knowledge of Scheme or Lisp is presupposed. </p> <p>See the <a href="http://gcc.gnu.org/wiki/MiddleEndLispTranslator">MELT wiki page</a> and the <a href="http://gcc-melt.org">GCC MELT site</a> </p> <table class="menu" border="0" cellspacing="0"> <tr><td align="left" valign="top"><a href="#MELT-Prerequisites">1.1 MELT Prerequisites</a></td><td> </td><td align="left" valign="top"> Prerequisites and topics not yet covered in this MELT chapter. </td></tr> <tr><td align="left" valign="top"><a href="#MELT-overview">1.2 MELT overview</a></td><td> </td><td align="left" valign="top"> An overview of MELT. </td></tr> <tr><td align="left" valign="top"><a href="#Building-the-MELT-branch">1.3 Building the MELT branch</a></td><td> </td><td align="left" valign="top"> Configuration and building requirements and instructions for MELT. </td></tr> <tr><td align="left" valign="top"><a href="#MELT-as-a-plugin">1.4 MELT as a plugin</a></td><td> </td><td align="left" valign="top"> Building and using MELT as a plugin. </td></tr> <tr><td align="left" valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td><td> </td><td align="left" valign="top"></td></tr> <tr><td align="left" valign="top"><a href="#Tutorial-about-MELT">1.6 Tutorial about MELT</a></td><td> </td><td align="left" valign="top"> Tutorial describing MELT. </td></tr> <tr><td align="left" valign="top"><a href="#Reference-on-MELT">1.7 Reference on MELT</a></td><td> </td><td align="left" valign="top"> MELT language reference. </td></tr> <tr><td align="left" valign="top"><a href="#Writing-C-code-for-MELT">1.8 Writing C code for MELT</a></td><td> </td><td align="left" valign="top"> How to write C code for MELT. </td></tr> </table> <hr size="6"> <a name="MELT-Prerequisites"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#MELT" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#MELT-overview" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#MELT" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="MELT-Prerequisites-1"></a> <h2 class="section">1.1 MELT Prerequisites</h2> <p>The reader is expected to have some working knowledge of some Lisp dialect (Common Lisp, Emacs Lisp, Guile, ...). The reader is also expected to be somehow familiar with the internal architecture of GCC (i.e. knowing what GCC <em>gimple</em>-s and <em>tree</em>-s are). </p> <p>MELT is different of other Lisps, because it is tightly suited to GCC internals. For that purpose, it has several peculiarities; MELT can: </p> <ul> <li> handle two kind of things. The MELT infrastructure can handle both MELT <em>values</em> (closures, lists, objects, ...) and GCC <em>stuff</em> (plain long integers, gimples, trees, ...), that it, datatypes appearing inside GCC. Both <em>values</em> and <em>stuff</em> are called MELT <em>things</em>. Notice that <em>stuff</em> is not handled polymorphically (due to a limitation of the GCC Garbage Collector). </li><li> generate C code. MELT source code (either in ‘<tt>*.melt</tt>’ files, or inside memory) is translated into C code suitable for GCC internals, in the style expected inside GCC. That generated C code is compiled into a MELT binary <em>module</em>, which is dynamically loaded by the MELT infrastructure. </li><li> provide linguistic devices. The MELT language has several <em>linguistic devices</em> to generate C code suitable for GCC internals, in the style expected by GCC. So MELT code contains constructs to fit into GCC, and to define operators related to GCC coding style. </li></ul> <hr size="6"> <a name="MELT-overview"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#MELT-Prerequisites" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#Building-the-MELT-branch" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#MELT" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="MELT-overview-1"></a> <h2 class="section">1.2 MELT overview</h2> <a name="index-MELT-overview"></a> <p>Any MELT enabling compilation is really a long lasting compilation. It is supposed that you use a powerful workstation (or laptop) with enough memory (at least 4Gigabytes of RAM is receommended on a 64 bits machine like x86-64), and that the MELT-enabled compilation will run a lot slower than a simple <code>gcc -O1</code> compilation (hopefully doing some useful stuff). Notice that a MELT-enabled compilation usually generates C code, compile it (using another GCC compilation process) to a dynamically loadable library, and load its into the MELT-enabled GCC compilation process started by the user. In practice, the compilation of the generated C code (which is much bigger than the original MELT source) is the main bottleneck. Often, when using an existing MELT module, no C code has to be generated (it already exists). </p> <p>The MELT plugin or branch contains several (related) stuff. Everything can be enabled or disabled at GCC run time: </p> <ol> <li> a Lisp dialect compiled into C code, with which one can code sophisticated or prototypical middle end passes. </li><li> a runtime which extends the GCC infrastructure to support the previous items, in particular a generational copying garbage collector well suited for the lisp dialect above, which is build above the existing GGC (which deals with old values). </li></ol> <p>MELT is bootstrapped, in the sense that the translation from the MELT dialect to C is coded in MELT (hence the MELT generated C code is available from the source code). </p> <p>The generated C code is including only one file <code>run-melt.h</code> which includes many GCC include files internal to the compiler. It is compiled into a dynamic library by a shell script <code>*melt-cc-script*</code> which invokes the host GCC with appropriate flags. </p> <p>MELT obviously need that the binary (dynamic libraries <code>warm*.so</code>) for the MELT translator are already available. More generally, it uses several kind of files: </p> <ol> <li> the script used to compile generated C files info dynamically loadable stuff. This script may be invoked by MELT GCC. In common cases, the first argument to the script is the MELT generated input <code>*.c</code> file and the second argument is the MELT loaded output <code>*.so</code> dynamic library. </li><li> an include directory (passed by <code>-I</code> to the compiler) containing all the useful GCC headers. This directory is only written by the installation procedure. </li><li> a permanent generated C code directory which contains some essential files, in particular the C form of the MELT translated. </li></ol> <p>MELT can be used as a plugin for GCC (and can also be compiled as a separate GCC branch). It uses some of the plugin machinery, even inside the MELT branch. </p> <p>When using MELT, it is important in practice to give it a work directory (where all generated C or object files go). </p> <hr size="6"> <a name="Building-the-MELT-branch"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#MELT-overview" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#MELT-as-a-plugin" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#MELT" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="Building-the-MELT-branch-1"></a> <h2 class="section">1.3 Building the MELT branch</h2> <a name="index-Building-the-MELT-branch"></a> <p>To compile the MELT branch, you need the Parma Polyhedra Library. The Parma Polyhedra Library (PPL) is a free library available <a href="http://www.cs.unipr.it/ppl/">here</a>, it is a C++ library (GPLv3 licensed) handling lattices like intervals etc. Also, the host compiler (the compiler which compiles the source code of GCC), also used to compile MELT generated C code during MELT enabled <code>gcc</code> execution, should be some version of <code>gcc</code> (preferably a 4.x version at least). </p> <p>Note that currently MELT is only compiled on Linux machines. </p> <p>MELT can also be used as a plugin to GCC (4.6). </p> <hr size="6"> <a name="MELT-as-a-plugin"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Building-the-MELT-branch" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#Invoking-MELT" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#MELT" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="MELT-as-a-plugin-1"></a> <h2 class="section">1.4 MELT as a plugin</h2> <a name="index-MELT-as-a-plugin"></a> <p>MELT can be used as a plugin to a GCC 4.6 (or better?) binary (i.e. future gcc 4.7) build with plugin enabled. You’ll need the GCC headers available to plugins, ‘<tt>gengtype</tt>’ and its state file to build and run the MELT plugin. </p> <p>Detailed instructions about building MELT as a plugin are available in the MELT plugin source tarball. </p> <hr size="6"> <a name="Invoking-MELT"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#MELT-as-a-plugin" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#Tutorial-about-MELT" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#MELT" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="Invoking-MELT-1"></a> <h2 class="section">1.5 Invoking MELT</h2> <a name="index-Invoking-MELT"></a> <p>Without any MELT specific program flags, the MELT variant of gcc behave as the trunk. So to get or use MELT features, you need to pass some special flags. Most of these flags are starting with <code>-fmelt</code> for the MELT branch or with <code>-fplugin-melt-arg</code> for the plugin. They for the middle-end of GCC so are common for every source language (ie <code>gcc</code>, <code>g++</code> … commands) and target. </p> <p>MELT is usually invoked while compiling a (C, C++, …) source file but may occasionnally be invoked with an empty C input to perform tasks which are not related to a particular GCC input source file. In practice, you should pass an empty C file to <code>gcc</code> for that purpose. In particular, the translation of a MELT file <code>foo.melt</code> into C code <code>foo.c</code> is done with a special invocation like <code>gcc -fmelt-mode=translatefile -fmelt-arg=foo.melt -fmelt-secondarg=foo.c</code> (possibly with other options like some appropriate <code>-fmelt-init=</code>). It is possible but deprecated to invoke with <code>-fmelt-mode=compilefile</code> instead of <code>-fmelt-mode=translatefile</code>. In other words, the MELT translator to C <em>is not</em> a GCC front-end, like e.g. <code>g++</code> is a C++ front-end of GCC. </p> <p>The table below lists all MELT specific options, in alphabetical order. We list both MELT branch options like <code>-fmelt-arg=</code> and MELT plugin option like <code>-fplugin-arg-melt-arg=</code> </p> <dl compact="compact"> <dt> <code>-fmelt-mode=</code></dt> <dd><table><tr><td> </td><td><pre class="smallexample">-fplugin-arg-melt-mode= </pre></td></tr></table> <a name="index-fmelt_002dmode"></a> <a name="index-fplugin_002darg_002dmelt_002dmode"></a> <p>This flag (called the MELT mode flag) is required for every MELT enabled compilation. If it is not given, no MELT specific processing is done. If given, this gives the mode to be used before any MELT passes. It uses the <code>:sysdata_mode_dict</code> field of <code>INITIAL_SYSTEM_DATA</code> internal object of MELT to determine the MELT function applied to execute the mode. If this application returns nil, no GCC compilation occur (i.e. no <code>*.c</code> or <code>*.cc</code> etc… source file is read). Hence, some modes may be used for their side-effects. In particular, the compilation of MELT lisp source file <code>*.melt</code> into C code <code>*.c</code> is done this way. </p> <p>Several modes may be given by separating them with commas. They are handled in that case in succession. </p> </dd> <dt> <code>-fmelt-arg=</code></dt> <dd><table><tr><td> </td><td><pre class="smallexample">-fplugin-arg-melt-arg= </pre></td></tr></table> <a name="index-fmelt_002darg_003d"></a> <p>This gives the first argument string to MELT. It is incompatible with the <code>-fmelt-arglist=</code> option. </p> </dd> <dt> <code>-fmelt-arglist=</code></dt> <dd><table><tr><td> </td><td><pre class="smallexample">-fplugin-arg-melt-arglist= </pre></td></tr></table> <a name="index-fmelt_002darglist_003d"></a> <a name="index-fplugin_002darg_002dmelt_002darglist_003d"></a> <p>This gives the first argument list of strings to MELT. It is incompatible with the <code>-fmelt-arg=</code> option. The string program argument is split into a list of strings using the comma separator. For example, <code>-fmelt-arglist=1,BB,3</code> makes a three-element list argument with first string <code>1</code>, second string <code>BB</code> and third string <code>3</code>. There is no way to give a string subargument containing a comma. </p> </dd> <dt> <code>-fmelt-print-settings=</code></dt> <dd><table><tr><td> </td><td><pre class="smallexample">-fplugin-arg-melt-print-settings= </pre></td></tr></table> <a name="index-fmelt_002dprint_002dsettings_003d"></a> <a name="index-fplugin_002darg_002dmelt_002dprint_002dsettings_003d"></a> <p>The builtin settings (notably MELT builtin modules directory and MELT builtin source directory) used by MELT are output in the given file, which should be source-able by a Posix shell if you are lucky enough. This is mostly useful in configuration, building, or packaging scripts. </p> </dd> <dt> <code>-fmelt-coutput=</code></dt> <dd><table><tr><td> </td><td><pre class="smallexample">-fplugin-arg-melt-coutput= </pre></td></tr></table> <a name="index-fmelt_002dcoutput_003d"></a> <a name="index-fplugin_002darg_002dmelt_002dcoutput_003d"></a> <p>This flag gives the name of the generated C file. </p> </dd> <dt> <code>-fmelt-output=</code></dt> <dd><table><tr><td> </td><td><pre class="smallexample">-fplugin-arg-melt-output= </pre></td></tr></table> <a name="index-fmelt_002dcoutput_003d-1"></a> <a name="index-fplugin_002darg_002dmelt_002doutput_003d"></a> <p>This flag gives the name of the generated files. </p> </dd> <dt> <code>-fmelt-debug</code></dt> <dd><table><tr><td> </td><td><pre class="smallexample">-fplugin-arg-melt-debug </pre></td></tr></table> <a name="index-fmelt_002ddebug"></a> <a name="index-fplugin_002darg_002dmelt_002ddebug"></a> <p>This flag has no argument and asks for lot of debugging output. It is only useful to debug MELT code and is unrelated to the <code>-g</code> flag asking GCC to output debug information. </p> </dd> <dt> <code>-fmelt-debugskip=</code></dt> <dd><table><tr><td> </td><td><pre class="smallexample">-fplugin-arg-melt-debugskip= </pre></td></tr></table> <a name="index-fmelt_002ddebugskip_003d"></a> <a name="index-fplugin_002darg_002dmelt_002ddebugskip_003d"></a> <p>This flag (only useful with <code>-fmelt-debug</code>) has an integer argument. When <code>-fmelt-debug</code> is given with <code>-fmelt-debugskip=1000</code> the first thousand debug messages are skipped, so are not printed. </p> </dd> <dt> <code>-fmelt-source-path=</code></dt> <dd><table><tr><td> </td><td><pre class="smallexample">-fplugin-arg-melt-source-path= </pre></td></tr></table> <a name="index-fmelt_002dsource_002dpath_003d"></a> <a name="index-fplugin_002darg_002dmelt_002dsource_002dpath_003d"></a> <p>This flag sets the path (colon separated list of directories) for sources (i.e. ‘<tt>*.melt</tt>’ and ‘<tt>*.c</tt>’). Otherwise use the <code>GCCMELT_SOURCE_PATH</code> environment variable. </p> </dd> <dt> <code>-fmelt-module-path=</code></dt> <dd><table><tr><td> </td><td><pre class="smallexample">-fplugin-arg-melt-module-path= </pre></td></tr></table> <a name="index-fmelt_002dmodule_002dpath_003d"></a> <a name="index-fplugin_002darg_002dmelt_002dmodule_002dpath_003d"></a> <p>This flag sets the path (colon separated list of directories) for MELT binary modules (i.e. ‘<tt>*.so</tt>’). Otherwise use the <code>GCCMELT_MODULE_PATH</code> environment variable. </p> </dd> <dt> <code>-fmelt-module-make-command=</code></dt> <dd><table><tr><td> </td><td><pre class="smallexample">-fplugin-arg-melt-module-make-command= </pre></td></tr></table> <a name="index-fmelt_002dmodule_002dmake_002dcommand_003d"></a> <a name="index-fplugin_002darg_002dmelt_002dmake_002dcommand_003d"></a> <p>This flag defines the <code>make</code> command used to build MELT binary modules (i.e. ‘<tt>*.so</tt>’). from a small set of generated C files. The default is the GNU make utility used to build MELT, very often just <code>make</code> or perhaps <code>gmake</code>. </p> </dd> <dt> <code>-fmelt-module-makefile=</code></dt> <dd><table><tr><td> </td><td><pre class="smallexample">-fplugin-arg-melt-module-makefile= </pre></td></tr></table> <a name="index-fmelt_002dmodule_002dmakefile_003d"></a> <a name="index-fplugin_002darg_002dmelt_002dmakefile_003d"></a> <p>This flag defines the makefile used to build MELT binary modules (i.e. ‘<tt>*.so</tt>’). from a small set of generated C files. The default is a file ‘<tt>melt-module.mk</tt>’. </p> </dd> <dt> <code>-fmelt-module-cflags=</code></dt> <dd><table><tr><td> </td><td><pre class="smallexample">-fplugin-arg-melt-module-cflags= </pre></td></tr></table> <a name="index-fmelt_002dmodule_002dcflags_003d"></a> <a name="index-fplugin_002darg_002dmelt_002dcflags_003d"></a> <p>This flag defines the <code>CFLAGS</code> passed to <code>make</code> to build MELT binary modules. If not given, the environment variable <code>GCCMELT_MODULE_CFLAGS</code> is used if it was set. </p> </dd> <dt> <code>-fmelt-init=</code></dt> <dd><table><tr><td> </td><td><pre class="smallexample">-fplugin-arg-melt-init= </pre></td></tr></table> <a name="index-fmelt_002dinit_003d"></a> <a name="index-fplugin_002darg_002dmelt_002dinit_003d"></a> <p>This flag sets the initial MELT modules. They are separated by semi-colons or (on Unix only) colons. So <code>-fmelt-init=foo:bar</code> or <code>'-fmelt-init=foo;bar'</code> (quotes are useful for the shell running GCC) load first the <code>foo</code> module and then the <code>bar</code> module. A module starting with an at sign <code>@</code> is handled as a module list file. The <code>.modlis</code> extension is added, and then a file is seeked by that name. This file is read line by line (with empty or blank lines skipped, and comment lines starting with an hash <code>#</code> skipped). Each line is the name of a module do be load in sequence. For example, <code>-fmelt-init=@mylist:bar</code> with a file ‘<tt>mylist.modlis</tt>’ containing </p><table><tr><td> </td><td><pre class="example"># file mylist.modlis ; just a comment alpha beta </pre></td></tr></table> <p>would have the same effect as <code>-fmelt-init=alpha:beta:bar</code>. Notice that modules are seeked in several directories. The notation <code>@@</code> is a shorthand for the default module list called ‘<tt>melt-default-modules.modlis</tt>’ and is the default value of this flag. </p> </dd> <dt> <code>-fmelt-extra=</code></dt> <dd><table><tr><td> </td><td><pre class="smallexample">-fplugin-arg-melt-extra= </pre></td></tr></table> <a name="index-fmelt_002dextra_003d"></a> <a name="index-fplugin_002darg_002dmelt_002dextra_003d"></a> <p>This flag sets the extra MELT modules. They are separated by semi-colons or (on Unix only) colons. Extra modules are also searched in the current directory, and are loaded after processing of MELT options. In practice, to use your own MELT module <code>foo</code> you should pass <code>-fmelt-extra=foo</code> because your module needs the default modules. </p> </dd> <dt> <code>-fmelt-tempdir=</code></dt> <dd><table><tr><td> </td><td><pre class="smallexample">-fplugin-arg-melt-tempdir= </pre></td></tr></table> <a name="index-fmelt_002dtempdir_003d"></a> <a name="index-fplugin_002darg_002dmelt_002dmelt_002dtempdir_003d"></a> <p>This flags sets the temporary MELT directory. If specified it is not cleaned. If it does not exist, it is mkdir-ed and cleaned. Avoid setting it to a non-empty directory which may contain files named like MELT modules (such as ‘<tt>warmelt-*.so</tt>’ etc.). </p> </dd> <dt> <code>-fmelt-option=</code></dt> <dd><table><tr><td> </td><td><pre class="smallexample">-fplugin-arg-melt-option= </pre></td></tr></table> <a name="index-fmelt_002doption_003d"></a> <p>This set some options for MELT. the argument is a comma separated sequence of options settings, each being an option name possibly followed by an equal sign and an option value. For example, <code>-fmelt-option=foo,bar=x</code> set the option <code>foo</code> and the option <code>bar</code> to <code>x</code>. An option name is case-insensitive and may appear several times. </p> </dd> <dt> <code>-fmelt-workdir=</code></dt> <dd><table><tr><td> </td><td><pre class="smallexample">-fplugin-arg-melt-workdir= </pre></td></tr></table> <a name="index-fmelt_002dworkdir_003d"></a> <a name="index-fplugin_002darg_002dmelt_002dmelt_002dworkdir_003d"></a> <p>This flags sets the working MELT directory. If specified all generated files go inside, and MELT modules are also loaded from it. Use that flag if you don’t want MELT related generated files to clobber your source tree. </p> </dd> </dl> <hr size="6"> <a name="Tutorial-about-MELT"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Invoking-MELT" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#Reserved-MELT-syntax-and-symbols" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#MELT" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="Tutorial-about-MELT-1"></a> <h2 class="section">1.6 Tutorial about MELT</h2> <a name="index-Tutorial-about-MELT"></a> <p>More up to date information may be found on <a href="http://gcc-melt.org">GCC MELT site</a>. </p> <p>As in all Lisps, parenthesis are important, so <code>a</code> and <code>(a)</code> do not mean the same thing. The first stuff after an opening parenthesis has usually an operator or syntactic keyword role. </p> <a name="index-upgrade_002dwarmelt-make-target-for-MELT"></a> <p>MELT is a Lisp dialect translated into (unreadable, or at least unfriendly) C code. Some MELT constructs, and some MELT limitations (e.g. lack of tail-recursion) are related to this C translatability. The MELT translator is itself written in MELT (files ‘<tt>gcc/melt/warmelt-*.melt</tt>’) and is bootstrapped; the translated C files are in ‘<tt>gcc/warmelt-*-0.c</tt>’; they are quite big and are distributed with the GCC source code; use the <code>upgrade-warmelt</code> target of ‘<tt>gcc/Makefile.in</tt>’ to regenerate these C translations. </p> <p>MELT is closely related to GCC internal passes and internal middle-end representations and runtime. Hence (in contrast to other LISP dialects) <em>MELT is dealing with both boxed values and unboxed stuff</em> (e.g. plain <code>long</code> integers as in C, but also <code>tree</code>s and <code>gimple</code>s, etc…, as inside GCC, separating them using their <em>ctype</em>). Keep always in mind the boxed versus unboxed distinction. Because of that, and because of GCC runtime (in particular the GGC garbage collector), MELT is neither polymorphic (you cannot deal with unboxed stuff like with boxed values) nor polytopic (no variable arguments facility). </p> <p>Some familiarity with other Lisp dialects and with GCC internals is required to code in MELT. </p> <p>The MELT runtime contains a copying generational garbage collector -GC- implemented in ‘<tt>gcc/melt-runtime.c</tt>’, backed up by the previously existing GCC ordinary (precise, marking) garbage collector GGC. The MELT-specific copying GC is designed for efficiency (but requires a very specific C coding style, easy to achieve in generated C code, but uncumfortable for human C developers), and handles well quick allocation of many short-lived objects [which is not a goald of GGC]. Therefore, <em>don’t be afraid of allocating a lot of values</em> inside MELT code. </p> <table class="menu" border="0" cellspacing="0"> <tr><td align="left" valign="top"><a href="#Reserved-MELT-syntax-and-symbols">1.6.1 Reserved MELT syntax and symbols</a></td><td> </td><td align="left" valign="top"> </td></tr> <tr><td align="left" valign="top"><a href="#Primitives-in-MELT">1.6.2 Primitives in MELT</a></td><td> </td><td align="left" valign="top"> </td></tr> <tr><td align="left" valign="top"><a href="#Citerators-in-MELT">1.6.3 Citerators in MELT</a></td><td> </td><td align="left" valign="top"> </td></tr> <tr><td align="left" valign="top"><a href="#Functions-in-MELT">1.6.4 Functions in MELT</a></td><td> </td><td align="left" valign="top"> </td></tr> </table> <p>This section has to be completed. </p> <hr size="6"> <a name="Reserved-MELT-syntax-and-symbols"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Tutorial-about-MELT" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#Primitives-in-MELT" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Tutorial-about-MELT" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="Reserved-MELT-syntax-and-symbols-1"></a> <h3 class="subsection">1.6.1 Reserved MELT syntax and symbols</h3> <p>The following symbols have specific MELT meaning. Use them only as described here and avoid redefining them. <code>and assert_msg comment compile_warning cond cppif current_module_environment_container debug_msg defciterator defclass definstance defprimitive defselector defun exit export_class export_macro export_values fetch_predefined forever get_field if instance lambda let make_instance match multicall or parent_module_environment progn put_fields quote return setq store_predefined unsafe_get_field unsafe_put_fields update_current_module_environment_container</code> </p> <p>Also avoid symbols starting with <code>def</code> </p> <hr size="6"> <a name="Primitives-in-MELT"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Reserved-MELT-syntax-and-symbols" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#Citerators-in-MELT" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Tutorial-about-MELT" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="Primitives-in-MELT-1"></a> <h3 class="subsection">1.6.2 Primitives in MELT</h3> <a name="index-Primitive-in-MELT"></a> <p>A MELT primitive defines an operator by specifying how to translate into C each of its invocation. As a simple example, the less-than integer operator <code><i</code> is defined as </p><table><tr><td> </td><td><pre class="lisp">(defprimitive <i <span class="roman">; define the primitive </span> (:long <span class="roman">; next formal arguments are longs</span> a b) <span class="roman">; the two formal arguments</span> :long <span class="roman">; the type of the result (also long)</span> "((" a ") < (" b "))") <span class="roman">; how to expand into C code</span> </pre></td></tr></table> <p>Later on, a MELT expression like <code>(<i <var>a</var> <var>b</var>)</code> gets translated into C code similar to <code>((curfnum[3]) < (curfnum[7]))</code> where <code>curfun[3]</code><a name="DOCF1" href="#FOOT1">(1)</a> is the translation of the normalized form<a name="DOCF2" href="#FOOT2">(2)</a> of <var>a</var>, etc. </p> <a name="index-unboxed-MELT-stuff"></a> <a name="index-ctype-in-MELT"></a> <p>Note that the above primitive accepts raw long integers (exactly the C <code>long</code> type) and returns such a long integer [0 if <code>((a)<(b))</code> was false in the C sense, and non-zero, perhaps -1, if it was true]. We say that such integers are <em>unboxed</em> stuff (we don’t speak of values in that case). The symbol <code>:long</code> represents the C type <code>long</code> and we call it a <em>ctype</em>. </p> <hr size="6"> <a name="Citerators-in-MELT"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Primitives-in-MELT" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#Functions-in-MELT" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Tutorial-about-MELT" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="Citerators-in-MELT-1"></a> <h3 class="subsection">1.6.3 Citerators in MELT</h3> <a name="index-Citerator-in-MELT"></a> <p>A MELT c-iterator or <em>citerator</em> is a construct which generalize iterative loops (like the <code>for</code> in C). As a trivial example, to iterate on positive integers till a limit, define </p> <table><tr><td> </td><td><pre class="lisp">(defciterator each-posint-till <span class="roman">; define each-posint-till citerator</span> (:long lim) <span class="roman">; start formal argument is lim</span> eachposint <span class="roman">; state symbol - uniquely substituted</span> (:long cur) <span class="roman">; local formals</span> ( <span class="roman">; start of before expansion</span> "long " eachposint ";" " for (" eachposint"=0; " eachposint "<" lim ";" eachposint "++) {" cur " = " eachposint; ) ( <span class="roman">; start of after expansion</span> "}" ) ) </pre></td></tr></table> <p>When used in a MELT expression like <code>(each-posint-till (5) (:long v) (print-long v))</code> -which has <code>:void</code> ctype because citerators are only useful for their side-effects- the C translation is vaguely similar (assuming <code>print-long</code> is a primitive expanding to <code>printf(``%d\n'',<var>…</var>)</code> to something looking like </p><table><tr><td> </td><td><pre class="example">curfnum[11] /*LIM*/ = 5; {long eachposint_24; for (eachposint_24=0; eachposint_24<curfnum[11]; eachposint_24++) { curfnum[3] /*V*/ = eachposint_24; printf("%d\n", curfnum[3] /*V*/); } } </pre></td></tr></table> <p>So the start formals is translated as some local variable in the MELT frame, the state symbol <code>eachposint</code> is only used to generate a C identifier (unique to each occurrence of the citerator) and the local formals are translated to local variables bound inside the iterators body. </p> <p>In practice, citerators are very useful for interfacing to the various iterating idioms in GCC. A more realistic example is </p><table><tr><td> </td><td><pre class="lisp"><span class="roman">;;;; iterate on a gimpleseq</span> (defciterator each_in_gimpleseq (:gimpleseq gseq) <span class="roman">;start formals</span> eachgimplseq (:gimple g) <span class="roman">;local formals</span> ( <span class="roman">;;; before expansion</span> "gimple_stmt_iterator gsi_" eachgimplseq ";\n" <span class="roman">;; test that <tt>gseq</tt> is not null to be safe</span> "if (" gseq ") for (gsi_" eachgimplseq " = gsi_start (" gseq "); !gsi_end_p (gsi_" eachgimplseq ");" " gsi_next (&gsi_" eachgimplseq ")) {\n" g " = gsi_stmt (gsi_" eachgimplseq ");" ) ( <span class="roman">;;; after expansion</span> "}" ) ) </pre></td></tr></table> <hr size="6"> <a name="Functions-in-MELT"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Citerators-in-MELT" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#Reference-on-MELT" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Tutorial-about-MELT" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="Functions-in-MELT-1"></a> <h3 class="subsection">1.6.4 Functions in MELT</h3> <a name="index-Function-in-MELT"></a> <p>As in many lisp dialect (e.g. Common Lisp) MELT functions are defined using the <code>defun</code> construct. The first argument (and the primary result) of all MELT function should always be a value, so it is not possible to give an unboxed <code>gimple</code> stuff to a function; hence we box it (pack it into a MELT value) before passing it as an argument. </p> <p>The following define a second-order function (actually defined in ‘<tt>ana-base.melt</tt>’) called <code>do_each_gimpleseq</code> which gets two arguments, the first being itself a MELT function and the second being an unobxed <code>gimple</code> stuff, and apply the first argument to boxes packing each <code>gimple</code> inside the given <code>gimpleseq</code>. </p> <table><tr><td> </td><td><pre class="lisp"><span class="roman">;; apply a function to each boxed gimple in a gimple seq</span> (defun do_each_gimpleseq (f :gimpleseq gseq) (each_in_gimpleseq (gseq) (:gimple g) (let ( (gplval (make_gimple discr_gimple g)) ) (f gplval))) ) </pre></td></tr></table> <p>This function is only useful for its side effect (calling a function for each member of a <code>gimpleseq</code>). It returns the nil value. </p> <p>The real translation to C of the above is a quite big and messy C function, actually: </p> <pre class="verbatim">static melt_ptr_t rout_9_DO_EACH_GIMPLESEQ (meltclosure_ptr_t closp_, melt_ptr_t firstargp_, const char xargdescr_[], union meltparam_un *xargtab_, const char xresdescr_[], union meltparam_un *xrestab_) { #if ENABLE_CHECKING static long call_counter__; long thiscallcounter__ ATTRIBUTE_UNUSED = ++call_counter__; #define callcount thiscallcounter__ #else #define callcount 0L #endif struct frame_rout_9_DO_EACH_GIMPLESEQ_st { unsigned nbvar; #if ENABLE_CHECKING const char *flocs; #endif struct meltclosure_st *clos; struct excepth_melt_st *exh; struct callframe_melt_st *prev; #define CURFRAM_NBVARPTR 5 void *varptr[5]; /*no varnum*/ #define CURFRAM_NBVARNUM /*none*/0 /*others*/ gimple_seq loc_CTYPE_GIMPLESEQ__o0; gimple loc_CTYPE_GIMPLE__o1; long _spare_; } curfram__; memset (&curfram__, 0, sizeof (curfram__)); curfram__.nbvar = 5; curfram__.clos = closp_; curfram__.prev = (struct callframe_melt_st *) melt_topframe; melt_topframe = (struct callframe_melt_st *) &curfram__; melt_trace_start ("DO_EACH_GIMPLESEQ", callcount); </pre> <p>The generated C function has a strange C formal arguments list (every applicable routine has the same signature in C. All arguments except the first are passed in an array of union, described by a short constant string, one character per argument, encoding its ctype. Secondary results are handled likewise). Some code is only enabled with <code>#if ENABLE_CHECKING</code> when GCC is configured for debugging (not for release). The MELT call frame is declared explicitly as a structure called <code>curfram__</code>, and is properly initialized, and set as the <code>melt_topframe</code>. The <code>melt_trace_strart MELT_LOCATION callcount</code> C macros are significant only when <code>#if ENABLE_CHECKING</code>. </p> <pre class="verbatim"> /*getarg#0 */ MELT_LOCATION ("ana-base.melt:436:/ getarg"); #ifndef MELTGCC_NOLINENUMBERING #line 436 "ana-base.melt" /**::getarg::**/ #endif /*MELTGCC_NOLINENUMBERING */ /*_.F__V2*/ curfptr[1] = (melt_ptr_t) firstargp_; </pre> <p>We start to fetch the first argument into the current frame, since <code>curfptr</code> is actually a C macro defined as <code>curfram__.varptr</code>. The <code>MELT_LOCATION</code> macro call (significant only when checking was enabled, and setting the <code>flocs</code> field of the current frame in that case) and the <code>#line</code> directive<a name="DOCF3" href="#FOOT3">(3)</a> refer to the MELT source location. For clarity, we now skip them, but there are <em>lots of such positional information</em> in the generated C code. Note that a single MELT source line is producing many C code lines (hence the line numbering seen in a debugger might be slightly wrong), and that some comments are generated (notably explaining what each <code>curfptr</code> occurrence means). </p> <pre class="verbatim"> /*getarg#1 */ if (xargdescr_[0] != BPAR_GIMPLESEQ) goto lab_endgetargs; curfram__.loc_CTYPE_GIMPLESEQ__o0 = xargtab_[0].bp_gimpleseq; goto lab_endgetargs; lab_endgetargs:; </pre> <p>The second argument is likewise fetched, only if the actual argument is of <code>gimpleseq</code> ctype. The useless goto is optimized by any serious C compiler (like gcc). </p> <pre class="verbatim">/*block*/ { /*citerblock EACH_IN_GIMPLESEQ */ { gimple_stmt_iterator gsi_cit1__EACHGIMPLSEQ; if ( /*_?*/ curfram__.loc_CTYPE_GIMPLESEQ__o0) for (gsi_cit1__EACHGIMPLSEQ = gsi_start ( /*_?*/ curfram__.loc_CTYPE_GIMPLESEQ__o0); !gsi_end_p (gsi_cit1__EACHGIMPLSEQ); gsi_next (&gsi_cit1__EACHGIMPLSEQ)) { /*_?*/ curfram__.loc_CTYPE_GIMPLE__o1 = gsi_stmt (gsi_cit1__EACHGIMPLSEQ); /*block */ { /*_.GPLVAL__V4*/ curfptr[3] = (meltgc_new_gimple ((meltobject_ptr_t) (( /*!DISCR_GIMPLE */ curfrout->tabval[0])), ( /*_?*/ curfram__.loc_CTYPE_GIMPLE__o1)));; </pre> <p>This is the beginning of a block generated by a citerator. It contains the translation of the <code>make_gimple</code> primitive use as a call to the <code>meltgc_new_gimple</code> C function. </p> <pre class="verbatim"> /*apply */ { /*_.F__V5*/ curfptr[4] = melt_apply ((meltclosure_ptr_t) ( /*_.F__V2*/ curfptr[1]), (melt_ptr_t) ( /*_.GPLVAL__V4*/ curfptr[3]), "", (union meltparam_un *) 0, "", (union meltparam_un *) 0); }; </pre> <p>This is the translation of the application of <code>f</code>. Since there only one argument and no secundary results, we pass null <code>union meltparam_un</code> pointers described by empty strings to follow the pecular conventions required by <code>melt_apply</code><a name="DOCF4" href="#FOOT4">(4)</a> and respected by MELT generated C functions implementing MELT routines. </p> <pre class="verbatim"> /*epilog */ /*clear *//*_.GPLVAL__V4*/ curfptr[3] = 0; /*clear *//*_.F__V5*/ curfptr[4] = 0; }; } /*citerepilog */ /*clear *//*_?*/ curfram__.loc_CTYPE_GIMPLE__o1 = 0; /*clear *//*_.LET___V3*/ curfptr[2] = 0; } /*endciterblock EACH_IN_GIMPLESEQ */ </pre> <p>Some MELT local variables are explicitly cleared. This helps the MELT garbege collector. The block generated for the citerator is ended, again by clearing some locals. </p> <pre class="verbatim"> /*epilog */ }; goto labend_rout; labend_rout: melt_trace_end ("DO_EACH_GIMPLESEQ", callcount); melt_topframe = (struct callframe_melt_st *) curfram__.prev; return (melt_ptr_t) ( /*noretval */ NULL); #undef callcount #undef CURFRAM_NBVARNUM #undef CURFRAM_NBVARPTR } /*end rout_9_DO_EACH_GIMPLESEQ */ </pre> <p>This is the whole function epilog. The MELT top frame is popped, and the previous is reinstated. </p> <p>Of course, nobody wants to read or understand the generated code above. </p> <p>In practice, such second-order functions (second order because they are functionals, consuming function arguments) are often used with anonymous functions using the <code>lambda</code> construct, eg </p><table><tr><td> </td><td><pre class="lisp">(do_each_gimpleseq (lambda (boxgimp) <span class="roman">;anonymous function with argument boxgimp</span> (let ( (:long gimp <span class="roman">; fetch the content of the boxed gimple value as an unboxed stuff</span> (gimple_content boxgimp)) ) <var>…. do something with <code>gimp</code> stuff ….</var> )) bgs <span class="roman">; some boxed gimple value</span> ) </pre></td></tr></table> <hr size="6"> <a name="Reference-on-MELT"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Functions-in-MELT" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#Lexical-MELT-conventions" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#MELT" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="Reference-on-MELT-1"></a> <h2 class="section">1.7 Reference on MELT</h2> <a name="index-Reference-on-MELT"></a> <table class="menu" border="0" cellspacing="0"> <tr><td align="left" valign="top"><a href="#Lexical-MELT-conventions">1.7.1 Lexical MELT conventions</a></td><td> </td><td align="left" valign="top"> </td></tr> <tr><td align="left" valign="top"><a href="#Main-MELT-syntax-and-features">1.7.2 Main MELT syntax and features</a></td><td> </td><td align="left" valign="top"> </td></tr> <tr><td align="left" valign="top"><a href="#MELT-modules-and-translation">1.7.3 MELT modules and translation</a></td><td> </td><td align="left" valign="top"> </td></tr> <tr><td align="left" valign="top"><a href="#Writing-GCC-passes-in-MELT">1.7.4 Writing GCC passes in MELT</a></td><td> </td><td align="left" valign="top"> </td></tr> </table> <hr size="6"> <a name="Lexical-MELT-conventions"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Reference-on-MELT" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#Main-MELT-syntax-and-features" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Reference-on-MELT" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="Lexical-MELT-conventions-1"></a> <h3 class="subsection">1.7.1 Lexical MELT conventions</h3> <p>It is recommended to edit MELT files with a Lisp-aware editor (e.g. the GNU emacs Lisp mode). </p> <p>As in Lisp dialects: </p> <ul> <li> parenthesis are essential and should be matched. It is an error to add extra right parenthesis. </li><li> brackets are like parenthesis but should be matched (but you probably don’t want to use them). <code>[a b]</code> is the same as <code>(a b)</code> but both <code>[a b)</code> and <code>(a b]</code> are incorrect. </li><li> comments start with a semicolon (<code>;</code>) to the end of the line. This is the prefered way to put comments in MELT file. </li><li> block comments start with hash-bar (<code>#|</code>), may take several lines, and end with bar-hash (<code>|#</code>). Don’t nest block comments. </li><li> space characters are token sepators, but indentation does not matter (we strongly recommend the MELT code to be properly indented, e.g. using Emacs Lisp mode, for readability purposes). </li><li> case is insensitive; words, i.e. identifiers and keywords are all converted to uppercases. </li><li> strings are denoted like in C between double quotes, with backslashes escaping (eg double-backslash <code>\\</code> to represent a single backslash, backslash doublequote <code>\"</code> to represent a doublequote, backslash t <code>\t</code> for a tab, , and <code>\xfe</code> to represent the character coded 0xfe in hex, etc. In addition, a backslash-leftbrace <code> \{ </code> read verbatim all characters up to the first rightbrace <code> } </code>. A string with the last doublequote followed by an underscore like <code>"do that"_</code> is localized using the <code>gettext</code> host system function; this could be useful for some user messages (to be translated to other languages like french). </li><li> symbols (i.e. identifiers) are case insensitive and may contain non alphanumerical characters like <code>_+-*/<>=!?:%~&@$</code>. It is advised to use these special characters sparingly. Symbols cannot start with any of <code>?%</code>. Because symbols are related to their C translation, is advised to avoid digits after underscores in symbols like <code>x_12</code> and to have each symbol contain at least one letter (e.g. use <code><i</code> instead of <code><</code>). </li><li> the quote character <code>'</code> is special. <code>'x</code> is parsed the same as <code>(quote x)</code>. </li><li> the backquote character <code>`</code> is special. <code>`x</code> means the same as <code>(backquote x)</code> </li><li> the comma character <code>,</code> is special. So <code>,x</code> means <code>(comma x)</code> and <code>,(a b)</code> is <code>(comma (a b))</code> </li><li> the question mark chararacter <code>?</code> is special when is is the first of a token (it may appear inside a symbol otherwise). For instance, <code>?x</code> means <code>(question x)</code> but <code>x?</code> is a symbol of two characters. So <code>?y?</code> is bad taste but means <code>(question y?)</code> </li><li> the hash character <code>#</code> is special. In particular, <code>#|</code> starts multiline comments; <code>#\space</code> is the integer code of the space character; <code>#b10</code> is a binary number (i.e. two), <code>#o12</code> is octal (ie ten), <code>#xffff</code> is hexadecimal number (ie 65535). <code>#{</code> starts macrostrings. </li><li> macro strings <a name="index-macro-string-in-MELT"></a> To avoid escaping many C-like caracters in C code chunks used for primitives, c-iterators, c-matchers etc.. an alternative multi-line lexical construct exist: the macro string started with <code>#{</code> and ending with <code>}#</code> possibly on a different line with <code>$</code> escapes like in C. For example, the <code>#{if ($A>0) printf("%s", $B);}# </code> macrostring is parsed exactly as the 5-elements s-expression <code> ("if (" A ">0) printf(\"%s\", " B ");")</code>. In a macrostring, all caracters are taken as is, except the dollar sign <code>$</code>; the macro-string itself is always read as an S-expr. When a dollar is followed by alphanumerical (or underscore) caracters like a C identifier, it is parsed as a symbol. If it is followed by an hash <code>#</code> caracter, that hash-character is skipped and terminate the symbol. The <code>$.</code> sequence is skipped and ignored, the double-dollar <code>$$</code> is read as a single dollar, the <code>$#</code> is read as a single hash <code>#</code>. <p>A macro-string starting with the four characters <code>#{$'</code> is expanded into a <code>(quote <var>...</var>)</code> expression and should preferably not contain symbols like <code>$<var>symb</var></code>. This special meaning of <code>$'</code> is only relevant when appearing at the very start of the macro-string. </p> </li><li> braces <code>{</code> and <code>}</code> are special. </li><li> numbers are integers in decimal like <code>-123</code> or <code>+22</code> or <code>33</code>. Notice that <code>1.2</code> is illegal; it is not a floating point number. </li><li> colons (i.e. <code>:</code>) starts constant (lisp-like) keywords which always evaluate to themselves. </li></ul> <p>Contrarily to some or most other Lisp dialects: </p> <ul class="toc"> <li>- don’t use the dot for cons-ing, e.g. <code>(a b . c)</code> is not legal. </li><li>- strings may contain escaped braces with special verbatim-like meaning. </li><li>- a string whose ending doublequote is immediately followed by an underscore (e.g. <code>"example of international"_</code>) is localized by calling <code>gettext</code> at read time. </li></ul> <hr size="6"> <a name="Main-MELT-syntax-and-features"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Lexical-MELT-conventions" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#MELT-formals" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Reference-on-MELT" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="Main-MELT-syntax-and-features-1"></a> <h3 class="subsection">1.7.2 Main MELT syntax and features</h3> <p>We list each key symbol in alphabetical order and provide a short derscription. Familiarity with some Lisp or Scheme dialect is required. </p> <table class="menu" border="0" cellspacing="0"> <tr><td align="left" valign="top"><a href="#MELT-formals">1.7.2.1 MELT formals</a></td><td> </td><td align="left" valign="top"> </td></tr> <tr><td align="left" valign="top"><a href="#MELT-ctypes">1.7.2.2 MELT ctypes</a></td><td> </td><td align="left" valign="top"> </td></tr> <tr><td align="left" valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td><td> </td><td align="left" valign="top"> </td></tr> <tr><td align="left" valign="top"><a href="#MELT-objects-and-classes">1.7.2.4 MELT objects and classes</a></td><td> </td><td align="left" valign="top"> </td></tr> <tr><td align="left" valign="top"><a href="#MELT-function-application">1.7.2.5 MELT function application</a></td><td> </td><td align="left" valign="top"> </td></tr> <tr><td align="left" valign="top"><a href="#MELT-function-abstraction-and-closures">1.7.2.6 MELT function abstraction and closures</a></td><td> </td><td align="left" valign="top"> </td></tr> <tr><td align="left" valign="top"><a href="#MELT-message-sending">1.7.2.7 MELT message sending</a></td><td> </td><td align="left" valign="top"> </td></tr> <tr><td align="left" valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td><td> </td><td align="left" valign="top"> </td></tr> </table> <hr size="6"> <a name="MELT-formals"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Main-MELT-syntax-and-features" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#MELT-ctypes" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Main-MELT-syntax-and-features" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="MELT-formals-1"></a> <h4 class="subsubsection">1.7.2.1 MELT formals</h4> <p>A formal argument list is a possibly empty list (between parenthesis). This list contains either ctype keywords or formal names. A ctype keyword apply to all further formals (until another ctype keyword, or end of formal arguments list. Ctypes have a keyword and are each described by a predefined instance (of <code>CLASS_CTYPE</code>) with a name conventionnally starting with <code>ctype_</code>. <a name="index-ctype-MELT-keyword"></a> [For experts: to add a new ctype, define a <code>BGLOB_CTYPE_*</code> predefined in ‘<tt>gcc/melt.h</tt>’ and an instance in ‘<tt>warmelt-first.melt</tt>’ using <code>install_ctype_descr</code>, then regenerate all the ‘<tt>gcc/warmelt-*.c</tt>’ files] </p> <hr size="6"> <a name="MELT-ctypes"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#MELT-formals" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#MELT-boxed-values" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Main-MELT-syntax-and-features" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="MELT-ctypes-1"></a> <h4 class="subsubsection">1.7.2.2 MELT ctypes</h4> <p>Here are the list of ctype-s. <a name="index-ctype-in-MELT-1"></a> </p> <ul> <li> <code>:value</code> (ctype instance <code>ctype_value</code>) This ctype is for MELT [boxed] values. It is the default ctype of arguments. </li><li> <code>:long</code> (ctype instance <code>ctype_long</code>) This ctype is for unboxed long integers; it is also used for conditions and tests. </li><li> <code>:tree</code> (ctype instance <code>ctype_tree</code>) This ctype is for GCC <code>tree</code> raw pointers, as in ‘<tt>gcc/tree.h</tt>’. </li><li> <code>:gimple</code> (ctype instance <code>ctype_gimple</code>) This ctype is for GCC <code>gimple</code> raw tuple pointers, as in ‘<tt>gcc/gimple.h</tt>’. </li><li> <code>:gimpleseq</code> (ctype instance <code>ctype_gimple</code>) This ctype is for GCC <code>gimple_seq</code> raw pointers, representing sequences of gimple instructions, as in ‘<tt>gcc/gimple.h</tt>’ </li><li> <code>:basicblock</code> (ctype instance <code>ctype_basicblock</code>) This ctype is for GCC <code>basic_block</code> raw pointers, representing basic blocks, as in ‘<tt>gcc/basic-block.h</tt>’ </li><li> <code>:edge</code> (ctype instance <code>ctype_edge</code>) This ctype is for GCC <code>edge</code> raw pointers, representing edges of the control flow graph, as in ‘<tt>gcc/basic-block.h</tt>’ </li><li> <code>:void</code> (ctype instance <code>ctype_void</code>) This ctype is the same as C <code>void</code> type. It should not be the type of formal arguments. It is only useful as the result type of side-effecting primitives. </li><li> <code>:cstring</code> (ctype instance <code>ctype_cstring</code>) This ctype is only for constant strings (like <code>const char[]</code> in C). It is not possible to build an unboxed <code>:cstring</code>. Every <code>:cstring</code> variable may only be bound to constant strings (not to something inside some heap). </li></ul> <p>MELT formal arguments appear in <code>lambda defun defprimitive defciterator multicall</code> forms. The first formal argument of <code>defun lambda multicall</code> constructs should -if given- be a <code>:value</code>. Ctype-s also appear in <code>let</code> bindings. Each MELT expression (or constant or variable) has a ctype (usually <code>:value</code>). </p> <p>The <code>:value</code> ctype is the only ctype for boxed values. Every other ctype is for unboxed stuff. </p> <hr size="6"> <a name="MELT-boxed-values"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#MELT-ctypes" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#MELT-objects-and-classes" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Main-MELT-syntax-and-features" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="MELT-boxed-values-1"></a> <h4 class="subsubsection">1.7.2.3 MELT boxed values</h4> <a name="index-minor-MELT-garbage-collection"></a> <a name="index-full-MELT-garbage-collection"></a> <a name="index-values-in-MELT"></a> <a name="index-boxed-values-in-MELT"></a> <p>Most data manipulated by MELT code are values. Values are allocated in the nursery generation of MELT heap, and are later (if alive) copied into GGC heap. A <em>minor MELT garbage collection</em>, which runs quickly and often, only copies live values (in particular, local variables of MELT functions) out of the nursery, into the GGC heap. A <em>full MELT garbage collection</em> also invokes the GGC collector, so scans the entire heap. </p> <p>MELT boxed values can be one of: </p> <ul> <li> nil <a name="index-nil-MELT-value"></a> (represented by the C <code>NULL</code> pointer and noted <code>()</code> in MELT) is a value. It is the initial or default value everywhere. </li><li> multiples <a name="index-multiple-MELT-value"></a> (or MELT tuples) - they are a fixed array of values agglomerated as a multiple. </li><li> closures <a name="index-closure-MELT-value"></a> (or MELT functional values) represent a functional value, containing a routine and closed values; the only way of making closures is thru the <code>lambda</code> and <code>defun</code> syntactic constructs. </li><li> routines <a name="index-routine-MELT-value"></a> are the reification of MELT functions (generated internally). </li><li> lists <a name="index-list-MELT-value"></a> are singly linked lists of pairs. Efficient access to the first and last pair of the list are provided. Unlike in many other Lisps, lists are not simply pairs (but implemented as the grouping of the first and last pair contained in the list), so appending a list to another one, or a single value at the beginning or the end of a list, is a simple operation. Lists are never circular and have a finite length. </li><li> pairs <a name="index-pair-MELT-value"></a> are like CONS pairs in most other Lisps. In particular, a list knows its first and last pair. The head of a pair is an arbitrary boxed value, but its tail is a pair or nil. </li><li> triples <a name="index-triple-MELT-value"></a> (rarely used) have arbitrary head and middle values, but the tail is a triple or nil. They could be used like A-lists’ nodes in Lisp. </li><li> integers <a name="index-integer-MELT-value"></a> (are actually boxed longs). </li><li> strings <a name="index-string-MELT-value"></a> (are like boxed cstrings; they are immutable, so the characters inside them do not change; they are terminated by a null byte, like in C). </li><li> string-buffers <a name="index-string_002dbuffer-MELT-value"></a> (are mutable buffers of strings and may grow appropriately; they are a bit like C++ string streams). </li><li> boxes <a name="index-box-MELT-value"></a> (like references in ML, are mutable boxed containers). </li><li> objects <a name="index-object-MELT-value"></a> have values in their fields (or slots) and are described below; each MELT object has a class (which is also a MELT object), which are organized in a single-inheritance class hierarchy rooted at <code>CLASS_ROOT</code>. </li><li> mixints <a name="index-mixints-MELT-value"></a> are mixing an arbitrary mutable MELT value and an integer. </li><li> mixlocs <a name="index-mixlocs-MELT-value"></a> (for experts; they are mixing an arbitrary mutable MELT value and a <code>location_t</code> indicating a location inside e.g. a MELT or C source file). </li><li> object maps <a name="index-object-map-MELT-value"></a> are an hashtable association between MELT objects and arbitrary MELT non-null [boxed] values. </li><li> string maps <a name="index-string-map-MELT-value"></a> are an hashtable dictionnary mapping strings to arbitrary non-null MELT values. </li><li> boxed ctypes <a name="index-boxed-ctype-MELT-value"></a> Each <em>ctype</em> has its boxed representation, which is a value containing the raw (unboxed) <em>ctype</em> like <code>gimple</code> etc.. </li><li> boxed ctype maps <a name="index-boxed-ctype-map-MELT-value"></a> Each <em>ctype</em> [except <code>:long :void :cstring</code>] has its boxed map, an hash table associating (non-null) stuff of the given ctype with arbitrary non-null MELT [boxed] values. For example, a gimple map associate GCC <code>gimple</code>s to arbitrary MELT non-null values (usually MELT objects). This is very useful to represent a relationship (conceptually an attribute) between <code>gimple</code>s and MELT values such as objects without having to enhance the definition of the <code>gimple</code> structure inside ‘<tt>gcc/gimple.h</tt>’ </li><li> special values <a name="index-special-MELT-values"></a> They are useful to represent stuff like MPFR things (arbitrary precision numbers), PPL coefficients, etc… The MELT runtime is able to run a sort of destructing C function when a special value is no more used, so the handling of special values is more expensive than for other values. </li></ul> <p>Notice that (contrarily to most other lisps) MELT symbols and MELT s-expressions are both objects (respectively of class <code>CLASS_SYMBOL</code> and <code>CLASS_SEXPR</code>). The reader function (which is not as versatile as in CommonLisp) deals with them. </p> <p>Adding additional MELT value types require enhancing the ‘<tt>gcc/melt.h</tt>’ and ‘<tt>gcc/melt.c</tt>’ files. </p> <a name="index-discriminant-for-MELT-values"></a> <p>Each MELT [boxed] value starts with a <em>discriminant</em>. This discriminant is a MELT object (it cannot be nil). The nil value has conceptually its own discriminant <code>DISCR_NULLRECV</code>, but is of course represented by C <code>NULL</code> pointer. Discriminants are used by the garbage collector (precisely to discriminate various MELT boxed data types using the object number of their discriminant), and by the MELT message sending machinery (hence messages sent to the nil MELT value are processed using the <code>DISCR_NULLRECV</code> discriminant). Each kind of MELT value has its own discriminant, but sometimes it is useful to have several discriminants possible for the same kind of MELT value. For example, MELT strings can have <code>DISCR_STRING</code> or <code>DISCR_VERBATIMSTRING</code> etc., and verbatim strings are handled specially (in particular when printing them inside generated C code). Every MELT [boxed] value has an immutable discriminant, set at the time of the value’s creation. </p> <p>Conventionally MELT non-object values have a primitive to test them called like <code>is_*</code>, a primitive to build them called like <code>make_*</code> [which takes a discriminant as the first argument], and the accessing and modifying primitives share a common prefix. In particular, object maps are tested with <code>is_mapobject</code>, built with <code>make_mapobject</code>, accessed with <code>mapobject_get</code> and updated using the <code>mapobject_put</code> and <code>mapobject_remove</code> primitives. For more details, look into file ‘<tt>gcc/melt/warmelt-first.melt</tt>’. </p> <hr size="6"> <a name="MELT-objects-and-classes"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#MELT-boxed-values" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#MELT-function-application" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Main-MELT-syntax-and-features" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="MELT-objects-and-classes-1"></a> <h4 class="subsubsection">1.7.2.4 MELT objects and classes</h4> <a name="index-object-MELT-values"></a> <a name="index-MELT-objects"></a> <p>An important (and common) kind of MELT [boxed] values are MELT objects. A MELT object contains exactly </p> <ul> <li> the discriminant or class <a name="index-MELT-classes"></a> <a name="index-class-in-MELT"></a> of the object; as every [boxed] value, MELT objects starts with a discriminant; for objects, it is their <em>class</em>, which is an object itself. We say “<var>Cl</var> is the class of <var>Ob</var>” or equivalently “<var>Ob</var> is a [direct] instance of <var>Cl</var>” when <var>Ob</var> is a MELT object of discriminant <var>Cl</var>. </li><li> the hash code of the object is an unsigned non-zero (more or less random, immutable i.e. fixed) integer, given at object build time (i.e. instanciation time). </li><li> the object number or <em>objnum</em> of the object is a small unsigned short integer. It is usually assigned at object build time. For discriminants <var>Di</var>, their objnum is also called the <em>magic number</em> of the values <var>Va</var> of the given discriminant <var>Di</var>. </li><li> the object length or size is the number of slots or fields of the objects. All objects <var>Ob</var> of a given class <var>Cl</var> have the same fixed number of slots (no more than 32767 slots and almost always a lot less, e.g. at most a dozen). Some objects could have a length of 0 (if their class is the <code>CLASS_ROOT</code> or has no direct or inherited fields), but this is very unusual. </li><li> the object slots or object fields are the values contained inside the object. These fields may be mutable; their number is fixed (it is the object length). </li></ul> <p>In practice, every object’s slot is described by a field object (of class <code>CLASS_FIELD</code>) inside the object’s class. </p> <p>Every discriminant (in particular every class) is an object with the following fields (or slots): </p><ul> <li> <code>prop_table</code> is the property object map associating objects to values, and usable as a P-list. </li><li> <code>named_name</code> is the boxed string naming the discriminant. </li><li> <code>disc_methodict</code> is an object map associating selectors to closures (method implementations). </li><li> <code>disc_super</code> is the super-discriminant (or the super-class for objects) </li></ul> <p>The root discriminant is <code>DISCR_ANYRECV</code>. The discriminant of the nil value is <code>DISCR_NULLRECV</code>. Other types of values have discriminants like <code>DISCR_ANYRECV DISCR_BASICBLOCK DISCR_BOX DISCR_CHARINTEGER DISCR_CLOSURE DISCR_EDGE DISCR_GIMPLE DISCR_GIMPLESEQ DISCR_INTEGER DISCR_LIST DISCR_MAPBASICBLOCKS DISCR_MAPEDGES DISCR_MAPGIMPLES DISCR_MAPGIMPLESEQS DISCR_MAPOBJECTS DISCR_MAPSTRINGS DISCR_MAPTREES DISCR_METHODMAP DISCR_MIXEDINT DISCR_MIXEDLOC DISCR_MULTIPLE DISCR_NAMESTRING DISCR_NULLRECV DISCR_PAIR DISCR_ROUTINE DISCR_SEQCLASS DISCR_SEQFIELD DISCR_STRBUF DISCR_STRING DISCR_TREE DISCR_VERBATIMSTRING</code>. Some discriminants are specialized by having a meaningful (i.e. not <code>DISCR_ANYRECV</code>) super-discriminant (i.e. the value inside the <code>:disc_super</code> slot). For example, <code>DISCR_METHODMAP</code> is used for object maps which are method maps (mapping a selector to a function implementing a method), instead of the plain <code>DISCR_MAPOBJECTS</code>. [For experts:] It is possible to make additional discriminants using <code>definstance</code> with <code>CLASS_DISCR</code> as the class. </p> <p>Classes are discriminants, but in addition have the following fields (or slots): </p><ul> <li> <code>class_ancestors</code> is the multiple (of discriminant <code>DISCR_SEQCLASS</code>) of the classes’ ancestors. Testing that a given object has some given class as its direct class or indirect ancestor is quick (<code>is_a</code> primitive in MELT, <code>melt_is_instance_of</code> function in C code). </li><li> <code>class_fields</code> is the multiple (of <code>DISCR_SEQFIELD</code>) of the classes’ fields (both inherited from ancestors or own to the class). </li><li> <code>class_objnumdescr</code> is usable for describing the objnum of instances. </li><li> <code>class_data</code> is an additional slot for holding class data. </li></ul> <p>Fields are slot descriptors (objects of <code>CLASS_FIELD</code>), they are named (so inherit fields <code>prop_table named_name</code>). Their objnum is their index, their specific slots are </p><ul> <li> <code>fld_ownclass</code> gives the class defining the field. </li><li> <code>fld_typinfo</code> can be used for describing the field’s type in instances. </li></ul> <p>Beware that the structure of classes, fields and discriminants is described not only in ‘<tt>warmelt-first.melt</tt>’ but also “built-in” in files ‘<tt>melt.c</tt>’ and ‘<tt>melt.h</tt>’ so changing them is very tricky. </p> <p>Fields should have a <em>globally unique</em> name. Conventionally, fields common to the same class share a common prefix for their name. </p> <p>The <code>defclass</code> construct builds and fills class and fields objects. Don’t make instances of <code>CLASS_CLASS</code> or <code>CLASS_FIELD</code> otherwise! </p> <p>Objects are built using the <code>make_instance</code> construct, or statically using <code>definstance</code>. In addition, <code>defselector defclass</code> also statically build objects (likes classes and fields). </p> <p>Exporting a class means exporting the class object and its own fields. </p> <hr size="6"> <a name="MELT-function-application"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#MELT-objects-and-classes" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#MELT-function-abstraction-and-closures" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Main-MELT-syntax-and-features" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="MELT-function-application-1"></a> <h4 class="subsubsection">1.7.2.5 MELT function application</h4> <p>Function applications are noted <code>(<var>fun</var> <var>args</var> <var>…</var>)</code>. There may be no arguments, e.g. just <code>(<var>fun</var>)</code>. If arguments are given, the first argument must be a <code>:value</code>. So <code>(f 1 x)</code> is incorrect (because <code>1</code> is an unboxed <code>:long</code>); use <code>(f x 1)</code> instead. Usually, the <var>fun</var>ction is just a variable bound to a function, but it may be a more complex expression, like <code>((if (p x) f g) x y)</code> which, depending on the test <code>(p x)</code> applies either <code>f</code> or <code>g</code> to <code>x y</code>. </p> <p>The application of a non-function returns null. The <code>melt_apply</code> C function doing the application checks that the applied function is indeed a function (ie a closure). Function applications are never tail-recursive; they always consume some stack space. </p> <p>Named functions are defined using the <code>defun</code> construct, using a Common Lisp like syntax (not the Scheme <code>define</code>). If the formal arguments list is not empty, its first element (the first formal argument of a named or anonymous function) should be a <code>:value</code>. </p> <p>Functions are not polytopic nor polymorphic; their signature is essentially fixed. They should expect a fixed number of arguments [there is no variable argument facility in MELT], each with a defined ctype (the first argument should be a <code>:value</code>), and return a fixed number of results (the first result should be a <code>:value</code>) each with a defined ctype. An argument which has not the expected ctype or is missing is initialized to null or 0. Likewise a secundary result which has not the expected ctype is ignored or set to null or 0. </p> <p>A function should [always] return a primary result of ctype <code>:value</code> and may also return secondary results (using the <code>return</code> construct). The only way of getting the secondary results of a function call (or a message send) is thrue the <code>multicall</code> construct, which binds all the results of the call or send to the formal arguments in the <code>multicall</code>. Function applications not done in a <code>multicall</code> have all their secondary results (if any) ignored. </p> <hr size="6"> <a name="MELT-function-abstraction-and-closures"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#MELT-function-application" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#MELT-message-sending" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Main-MELT-syntax-and-features" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="MELT-function-abstraction-and-closures-1"></a> <h4 class="subsubsection">1.7.2.6 MELT function abstraction and closures</h4> <p>Function abstraction (i.e. making anonymous functions) is done using the <code>lambda</code> construct. <em>Only values can be closed</em>, hence it is not possible to close a non-boxed value, so <code>(let ( (:long one 1) ) (lambda (a) (f a one)))</code> is incorrect (and rejected by the MELT translator). </p> <p>Actually, every MELT function is really a closure, so <code>defun</code> binds a name to the closure which is the named function. </p> <p>Closures are <code>:value</code>s. Use the <code>is_closure</code> primitive to test tha a given value is indeed a closure. The only way of building closures is thru <code>lambda</code> or <code>defun</code>. Closures contain a routine pointer (routines are also <code>:values</code>) and closed values. [For experts] the size of a closure is available thru the <code>closure_size</code> primitive. Its routine is available thru <code>closure_routine</code> primitive. To get its n-th closed value, use the <code>closure_nth</code> primitive. At MELT runtime, each MELT call frame for MELT function application (or message sending) knows its closure. </p> <p>Routines correspond to MELT generated C functions (with their constant values). </p> <hr size="6"> <a name="MELT-message-sending"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#MELT-function-abstraction-and-closures" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#MELT-syntax-constructs" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Main-MELT-syntax-and-features" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="MELT-message-sending-1"></a> <h4 class="subsubsection">1.7.2.7 MELT message sending</h4> <p>A message invocation is done using the construct <code>(<var>selector-name</var> <var>reciever</var> <var>args</var> <var>…</var>)</code>. This construct is syntactically the same as function (or primitive) application, and is discriminated by the fact that the <var>selector-name</var> has been previously defined with <code>defselector</code> or is imported as bound to an instance of <code>CLASS_SELECTOR</code>. The selector should be such a name and cannot be an expression. The <var>reciever</var> can be any <code>:value</code> (even null). The <var>args</var> are optional and can have any ctype (but a selector should have a fixed and well defined signature). Use <code>export_values</code> to export selectors. </p> <p>A method is just a functional value, installed thru the <code>install_method</code> function. This function expects a discriminant or class, a selector, and a function (the method). Method installation is very dynamic and can be done at any time. </p> <p>A message invocation (i.e. an expression starting with a selector) can be done on any boxed value. If it is an object, its class is used; otherwise its discriminant is used (so <code>DISCR_NULLRECV</code> is used when sending to nil). To send a message of selector <var>sel</var> (an instance of <code>CLASS_SELECTOR</code>) to a reciever <var>recv</var> of discriminant (e.g. the class of an object) <var>dis</var>, the following procedure is used: </p> <ul> <li> <var>dis</var> should be a discriminant; if it is not an instance of <code>CLASS_DISCR</code>, stop and do nothing. </li><li> get the <code>discr_methodmap</code> slot of <var>dis</var>; it should be an object map (i.e. a “dictionnary” of methods) that we call <var>md</var>. </li><li> get the method <var>meth</var> associated to <var>sel</var> in <var>md</var>; if <var>meth</var> is a function (i.e. a boxed MELT closure), apply <var>meth</var> to the reciever <var>recv</var> and any additional arguments. This ends the message invocation. </li><li> otherwise, no method is found, so replace <var>dis</var> by its super-discriminant (its slot <code>disc_super</code>) and repeat again. Hence, methods are also looked in superclasses, etc… so are properly inherited. </li></ul> <p>Notice that message invocation is more dynamic (hence slower) than e.g. C++ virtual member functions, and that method maps can be upgraded at any time. </p> <hr size="6"> <a name="MELT-syntax-constructs"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#MELT-message-sending" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#MELT-modules-and-translation" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Main-MELT-syntax-and-features" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="MELT-syntax-constructs-1"></a> <h4 class="subsubsection">1.7.2.8 MELT syntax constructs</h4> <p>The table below gives MELT syntax constructs, in alphabetical order. [Experts can add new constructs using macros, and implementing appropriate methods in the MELT translator]. </p> <dl compact="compact"> <dt> <code>and</code></dt> <dd><a name="index-and-MELT-syntax"></a> <p><code>(and <var>e1</var> <var>e2</var> <var>e3</var> <var>…</var>)</code> is (like in all Lisps) used for sequential conjunction; it is the same as <code>(if <var>e1</var> (if <var>e2</var> <var>e3</var>))</code> etc… Any number (at least one) of conjuncts are possible. All the conjuncts (<var>e1</var> <var>…</var>) should have the same ctype (usually <code>:value</code>). </p> </dd> <dt> <code>assert_msg</code></dt> <dd><a name="index-assert_005fmsg-MELT-syntax"></a> <a name="index-assert_005ffailed-MELT-primitive"></a> <p><code>(assert_msg <var>msg</var> <var>check</var>)</code> aborts when <var>check</var> is false (using the <code>assert_failed</code> primitive, giving the source file position) and displays the given <var>msg</var>, when GCC is built for debugging with <code>ENABLE_CHECK</code>. If GCC is not built for debugging, neither operand is used. The entire <code>assert_msg</code> expression evaluates to nil. </p> </dd> <dt> <code>comment</code></dt> <dd><a name="index-comment-MELT-syntax"></a> <p><code>(comment <var>msg</var>)</code> evaluates to nil and output the <var>msg</var> as a C comment in the C translation. Don’t use <code>*/</code> or <code>*/</code> in <var>msg</var>. When a <code>comment</code> appears at the beginning of a MELT compilation unit, it appears at the beginning of the generated C file; this is useful for making copyright notices appear both in the MELT source file and the generated C code. </p> </dd> <dt> <code>compile_warning</code></dt> <dd><a name="index-compile_005fwarning-MELT-syntax"></a> <p><code>(compile_warning <var>msg</var> <var>exp</var>)</code> evaluates like <var>exp</var> but also emits a message at MELT compilation time. Intended use is similar to <code>#warning</code> in C. </p> </dd> <dt> <code>cond</code></dt> <dd><a name="index-cond-MELT-syntax"></a> <p><code>(cond <var>condition1</var> <var>condition2</var> <var>…</var>)</code> is -like in all Lisps- a conditional evaluation. Each condition is <code>(<var>test</var> <var>then1</var> <var>then2</var> <var>…</var> <var>thenk</var>)</code> so the <var>test</var> is evaluated. If it is true, all the <var>then</var>s are evaluated in sequence, and the last is the result of the whole <code>cond</code> expression. The last condition can be <code>(:else <var>else1</var> <var>…</var> <var>elsek</var>)</code>; if no previous test succeeded, all the <var>else</var>s are sequentially evaluated, and the last of them is the whole <code>cond</code> result. Notice that <code>(cond (<var>test1</var> <var>then1</var>) (<var>test2</var> <var>then2a</var> <var>then2b</var>) (:else <var>else1</var> <var>else2</var> <var>else3</var>))</code> is the same as <code>(if <var>test1</var> <var>then1</var> (if <var>test2</var> (progn <var>then2a</var> <var>then2b</var>) (progn <var>else1</var> <var>else2</var>)))</code>. </p> </dd> <dt> <code>cppif</code></dt> <dd><a name="index-cppif-MELT-syntax"></a> <p>[for experts] <code>(cppif <var>name</var> <var>then-cpp</var> <var>else-cpp</var>)</code> is translated using a C directive <code>#if <var>name</var></code> to the translation of <var>then-cpp</var> or <var>else-cpp</var>. </p> </dd> <dt> <code>current_module_environment_container</code></dt> <dd><a name="index-current_005fmodule_005fenvironment_005fcontainer-MELT-syntax"></a> <p>[for experts] <code>(current_module_environment_container)</code> evaluates to an object of <code>CLASS_CONTAINER</code> containing the current module environment. </p> </dd> <dt> <code>debug_msg</code></dt> <dd><a name="index-debug_005fmsg-MELT-syntax"></a> <p><code>(debug_msg <var>expv</var> <var>msg</var> [<var>count</var>])</code> -where the <var>count</var> expression (of ctype <code>:long</code>) is usually ommitted- is useful for debugging ouput of the value of <var>expv</var> (with the <code>-fmelt-debug</code> program option) to output, using the <code>debug_msg_fun</code> function. The entire <code>debug_msg</code> expression is somehow equivalent to <code>(cppif ENABLE_CHECKING (debug_msg_fun <var>expv msg count filename lineno</var>) ())</code> and evaluates to nil. </p> </dd> <dt> <code>defciterator</code></dt> <dd><a name="index-defciterator-MELT-syntax"></a> <p>The form <code>(defciterator <var>iter-name</var> <var>start-formals</var> <var>state-symbol</var> <var>local-formals</var> <var>before-expansion</var> <var>after-expansion</var>)</code> defines a C-iterator named <var>iter-name</var>. The <var>start-formals</var> is a [binding] list of formal arguments [given to the C-iterator]. The <var>state-symbol</var> is usable in the expansions, where it is expanded to a unique C identifier. The <var>local-formals</var> is a [binding] list of variables local to the expanded block. The <var>before-expansion</var> and <var>after-expansion</var> are lists of items like strings (appearing as is in the C expansion) or symbols (either from the start formals, or the local formals, or the state symbol). </p> </dd> <dt> <code>defclass</code></dt> <dd><a name="index-defclass-MELT-syntax"></a> <p>The form <code>(defclass <var>class-name</var> [:predef <var>predefined</var>] [:super <var>superclass-name</var>] :fields <var>fields-list</var>)</code> defines a class named <var>class-name</var> of super-class named <var>superclass-name</var> with the given <var>fields-list</var> (a list of field names) and an optional <var>predefined</var> name (for predefined classes [giving a <var>predefined</var> is for experts]). </p> </dd> <dt> <code>defcmatcher</code></dt> <dd><a name="index-defcmatcher-MELT-syntax_002e"></a> <p>The form <code>(defcmatcher <var>cmatcher-name</var> <var>match&in-formals</var> <var>out-formals</var> <var>state-sym</var> <var>test-expansion</var> <var>fill-expansion</var> <var>oper-expansion</var>)</code> defined a matching construct by its C translation. The <var>match&in-formals</var> gives the matched thing ctype (as the first formal argument, either a boxed value or a raw stuff) and input arguments (rest of formals). The <var>out-formals</var> are the signature of the deconstructed things. The <var>test-expansion</var> expands (as a C boolean-like expression) to the test part of the match. The <var>fill-expansion</var> expands (as a sequence of C instructions) to the deconstructing part. The <var>oper-expansion</var> is used, much like in primitives, when the <var>cmatcher-name</var> appears as an operator in an expression context. </p> </dd> <dt> <code>definstance</code></dt> <dd><a name="index-definstance-MELT-syntax"></a> <p>The form <code>(definstance <var>instance-name</var> <var>class-name</var> [:predef <var>predefined</var>] [:obj_num <var>object-number</var>] <var>:field-name</var> <var>field-value</var> <var>…</var>)</code> statically defines an instance of name <var>instance-name</var> of the class <var>class-name</var>. [expert usage: a <var>predefined</var> name and an <var>object-number</var> may also be given]. </p> </dd> <dt> <code>defprimitive</code></dt> <dd><a name="index-defprimitive-MELT-syntax"></a> <p>The form <code>(defprimitive <var>primitive-name</var> <var>formals-arglist</var> <var>ctype</var> <var>expansion</var> <var>…</var>)</code> statically defines a C primitive named <var>primitive-name</var> of a given <var>formals-list</var> and given return <var>ctype</var>. The <var>expansion</var>-s are either strings or formal names. </p> </dd> <dt> <code>defselector</code></dt> <dd><a name="index-defselector-MELT-syntax"></a> <p>The form <code>(defprimitive <var>selector-name</var> <var>selector-class</var> <var>:field-name</var> <var>field-value</var> <var>…</var>)</code> defines a selector. Usually <var>selector-class</var> is <code>CLASS_SELECTOR</code>, and no other <var>field</var>s are given. Once a name is bound to a selector, every further occurrence of that name in operator position is considered as a message invocation. </p> </dd> <dt> <code>defun</code></dt> <dd><a name="index-defun-MELT-syntax"></a> <p>The form <code>(defun <var>function-name</var> <var>formals-list</var> <var>body</var> <var>…</var>)</code> define a function named <code>function-name</code>. The ctype of the first (if any) formal argument (in the <var>formals-list</var>) should be a <code>:value</code>. The <code>function-name</code> can appear in the given <var>body</var> (for recursion). </p> </dd> <dt> <code>exit</code></dt> <dd><a name="index-exit-MELT-syntax"></a> <p>The form <code>(exit <var>loop-label</var> <var>expr</var> <var>…</var>)</code>, only used inside <code>forever</code> loops, causes the lexically enclosing <code>forever</code> loop named by <var>loop-label</var> to be exited, after evaluation of the <var>expr</var>s. The last such value (or nil if no <var>expr</var> is given) is the result returned by the <code>forever</code> loop. <code>exit</code> forms are similar to Ada’s <code>exit</code> or C <code>break</code> (not to <code>longjmp</code>). The <code>exit</code> should be local to the containing procedure: it cannot jump across <code>lambda</code>s. </p> </dd> <dt> <code>export_class</code></dt> <dd><a name="index-export_005fclass-MELT-syntax"></a> <p>The form <code>(export_class <var>class-name</var> <var>…</var>)</code> export all the given <var>class-name</var>s and their fields. </p> </dd> <dt> <code>export_macro</code></dt> <dd><a name="index-export_005fmacro-MELT-syntax"></a> <p>[For experts] The form <code>(export_macro <var>macro-symbol</var> <var>expander</var>)</code> exports a macro binding for the given <var>macro-symbol</var> with the <var>expander</var> function. The macro <code>macro-symbol</code> is defined in the environment exported by the current module, so is available in other modules only (but not in the current one). </p> </dd> <dt> <code>export_patmacro</code></dt> <dd><a name="index-export_005fpatmacro-MELT-syntax"></a> <p>[For experts, not implemented] The form <code>(export_patmacro <var>patmacro-symbol</var> <var>pat-expander</var> <var>mac-expander</var>)</code> exports a pattern macro binding for the given <var>patmacro-symbol</var> with the <var>pat-expander</var> as a pattern expanding function (used in patterns) and the <var>mac-expander</var> as a macro expanding function (used in expressions). </p> </dd> <dt> <code>export_values</code></dt> <dd><a name="index-export_005fvalues-MELT-syntax"></a> <p>The form <code>(export_values <var>exported-name</var> <var>…</var>)</code> export all the names, as values, given as arguments. For classes, <code>export_class</code> should be used, otherwise the fields are not exported. </p> </dd> <dt> <code>fetch_predefined</code></dt> <dd><a name="index-fetch_005fpredefined-MELT-syntax"></a> <p>[For experts] <code>(fetch_predefined <var>predefined-name-or-number</var>)</code> </p> </dd> <dt> <code>forever</code></dt> <dd><a name="index-forever-MELT-syntax"></a> <p><code>(forever <var>label-name</var> <var>body</var> <var>…</var>)</code> when evaluated, the bodies are evaluated in sequence, and indefinitely re-evaluated again. The only way of getting out from a <code>forever</code> loop is with <code>exit</code> (using the given <var>label-name</var>, lexically inside the body) or <code>return</code>. Avoid using a bound variable name as a <var>label-name</var>. </p> </dd> <dt> <code>get_field</code></dt> <dd><a name="index-get_005ffield-MELT-syntax"></a> <p><code>(unsafe_get_field <var>:field-name</var> <var>expr</var>)</code> retrieves the field named <var>:field-name</var> from the object returned by <var>expr</var> expression. If it is not an appropriate object (of the class owning the <var>:field-name</var>) , gives nil. </p> </dd> <dt> <code>if</code></dt> <dd><a name="index-if-MELT-syntax"></a> <p><code>(if <var>test</var> <var>then-exp</var> [<var>else-exp</var>])</code>. When evaluated, the <var>test</var> is first evaluated. If it is true, the <var>then-exp</var> is evaluated and is the result of the whole <code>if</code>. If it is false (either 0 if ctype-d <code>:long</code>, or the null pointer for <code>:value</code> and other ctypes), the optional <var>else-exp</var> is evaluated (or 0 or null) and is the result of the whole <code>if</code>. Both the <var>then-exp</var> and the <var>else-exp</var> (if given) should have the same ctype. </p> </dd> <dt> <code>instance</code></dt> <dd><a name="index-instance-MELT-syntax"></a> <p><code>(instance <var>class-name</var> [<var>:field-name</var> <var>field-value</var>] <var>…</var>)</code> is a constrctive expression for instances, where the <var>class-name</var> is the name of a class (it cannot be a complex expression but should be a class statically known) and where each <var>:field-name</var> keyword (starting with a colon) is the name of some field (direct or inherited) of the class and the following <var>field-value</var> is an expression giving its initial value; the result of <code>instance</code> is a freshly built instance of the given <var>class-name</var> initialized with the fields (fields which are not mentionned are initialized with nil). </p> </dd> <dt> <code>lambda</code></dt> <dd><a name="index-lambda-MELT-syntax"></a> <p><code>(lambda <var>formal-args</var> <var>body</var> <var>…</var>)</code> is a constructive expression for function abstraction, it returns a closure, the anonymous function taking <var>formal-args</var> as arguments and evaluating sequentially the <var>body</var> expressions, returning the value of the last one. The first argument of a function and the first result that it is returning should be a <code>:value</code>. </p> </dd> <dt> <code>let</code></dt> <dd><a name="index-let-MELT-syntax"></a> <p><code>(let (<var>let-binding</var> <var>…</var>) <var>body</var> <var>…</var>) is a sequential binding construct (closer to <code>let*</code> in other Lisps)</code>. The first operand should be a list of <var>let-binding</var>s. Others operands make the <var>body</var>, evaluated in sequence with the new bindings applied with lexical scoping. A <var>let-binding</var> is an optional <em>ctype</em> (<code>:value</code> by default) followed by a variable name (ie a symbol) followed by one expression. Variables bound by previous <var>let-binding</var>s are visible in the expression inside the current <var>let-binding</var> (so recursion is not permitted like with <code>flet</code> or <code>letrec</code> in some Lisps). Notice that a <var>let-binding</var> can bind a variable to unboxed stuff (like a plain long integer). The result of the whole <code>let</code> expression is the result of the evaluation of the last body expression, done with the new bindings. </p> </dd> <dt> <code>letrec</code></dt> <dd><a name="index-letrec-MELT-syntax"></a> <p><code>(let (<var>letrec-binding</var> <var>…</var>) <var>body</var> <var>…</var>)</code> is a recursive binding construct. The letrec bindings should only bind <em>constructive expressions</em>, that is <code>lambda</code>-s, <code>tuple</code>-s, <code>instance</code>-s and <code>list</code>-s. </p> </dd> <dt> <code>list</code></dt> <dd><a name="index-list-MELT-syntax"></a> <p><code>(list <var>expr</var> <var>…</var>)</code> is a constructive expressions for lists. It returns a tuple made of the arguments. </p> </dd> <dt> <code>match</code></dt> <dd><a name="index-match-MELT-syntax"></a> <p><code>(match <var>expr</var> <var>match-case</var> <var>…</var> )</code> <em>NOT IMPLEMENTED YET</em> Do a pattern match. Evaluate <var>expr</var> and for the first maching <var>match-case</var>, do its body. There is no <code>:else</code> clause, use the joker pattern <code>?_</code> for that purpose. A <var>match-case</var> is a simple match case <code>(<var>pattern</var> <var>body</var> <var>…</var>)</code> where <var>body</var> is evaluated with the pattern variables appearing in <var>pattern</var> bound. A <var>match-cas</var> can be a when match case <code>(:when <var>pattern</var> <var>when-cond</var> <var>body</var> <var>…</var>)</code> where the body is done when that pattern matches and the <var>when-cond</var> (evaluated with the pattern variables bound) is a true condition. </p> </dd> <dt> <code>multicall</code></dt> <dd><a name="index-multicall-MELT-syntax"></a> <p><code>(multicall (<var>result-formals</var>) <var>call-expr</var> <var>body</var> <var>…</var>)</code> is the only way to retrieve multiple (one primary and some secondary) results from a function application or a message invocation <var>call-expr</var> (which should syntactically be an application or an invocation, not anything else). The <var>result-formals</var> are syntactically like formal arguments; See section <a href="#MELT-formals">MELT formals</a>. The first result formal should be of ctype <code>:value</code>. Secondary result formals which are not matching the ctype of the actual secondary result are cleared. The bindings of the result formals are local to the <code>multicall</code> expression and usable in the <var>body</var> sequence. </p> </dd> <dt> <code>or</code></dt> <dd><a name="index-or-MELT-syntax"></a> <p><code>(or <var>e1</var> <var>e2</var> <var>e3</var> <var>…</var>)</code> is the sequential disjunction of <var>e1</var> <var>…</var> (at least one disjunct). In particular <code>(or <var>a</var> <var>b</var>)</code> is the same as <code>(if <var>a</var> <var>a</var> <var>b</var>)</code> except that <var>a</var> is evaluated once. All the disjuncts should have the same ctype (usually <code>:value</code>). </p> </dd> <dt> <code>parent_module_environment</code></dt> <dd><a name="index-parent_005fmodule_005fenvironment-MELT-syntax"></a> <p>[For experts] <code>(parent_module_environment)</code> return the parent module’s environment. </p> </dd> <dt> <code>progn</code></dt> <dd><a name="index-progn-MELT-syntax"></a> <p><code>(progn <var>e1</var> <var>e2</var> <var>…</var> <var>en</var>)</code> evaluates successfully <var>e1</var> then <var>e2</var> and return the value of the last <var>en</var>. </p> </dd> <dt> <code>put_fields</code></dt> <dd><a name="index-put_005ffields-MELT-syntax_002e"></a> <p><code>(put_fields <var>obj</var> <var>:field-name1</var> <var>val1</var> <var>…</var>)</code> updates the object value of <var>obj</var> by changing its field named <var>:field-name1</var> to the value of <var>val1</var> etc… (all the fields are updated at once). It is safe, in the sense that if <var>obj</var> is not an object of the appropriate class, nothing happens. </p> </dd> <dt> <code>quote</code></dt> <dd><a name="index-quote-MELT-syntax"></a> <p><code>(quote x)</code> is the same as <code>'x</code> and returns the symbol <code>x</code> itself (as an instance of <code>CLASS_SYMBOL</code>). When applied to an integer, like <code>'1</code>, it gives a constant boxed integer value (of <code>DISCR_INTEGER</code>). When applied to a string, like <code>'"string"</code>, it gives a constant boxed string value (of <code>DISCR_STRING</code>). Therefore, when passed as an actual argument (to a primitive, a function, ...) <code>'1</code> (a boxed integer value) is not the same as <code>1</code> (a raw integer stuff), and likewise <code>'"abc"</code> is a boxed string value, different of <code>"abc"</code> (a raw string stuff). This is very different from other Lisps! Only symbols, strings, integers can be quoted. </p> </dd> <dt> <code>return</code></dt> <dd><a name="index-return-MELT-syntax"></a> <p><code>(return <var>e1</var> <var>…</var>)</code> return from the entire containing function (i.e. <code>defun</code> or <code>lambda</code>). The first expression <var>e1</var> should be of ctype <code>:value</code> and is evaluated as the primary result. Other expressions are evaluated (and can have different ctypes) and returned as secondary results. A <code>(return)</code> without argument is a convenience for returning the nil value. The ctype of the <code>return</code> is <code>:value</code> even if the <code>return</code> expression itself does not gives a value (because it breaks the control flow), hence <code>(or (return) 'x)</code> is acceptable but tasteless. </p> </dd> <dt> <code>setq</code></dt> <dd><a name="index-setq-MELT-syntax"></a> <p><code>(setq <var>var</var> <var>exp</var>)</code> assigns to the local variable <var>var</var> the value of <var>exp</var> (which is also the value of the entire <code>setq</code> expression). Both <var>var</var> and <var>exp</var> should have the same ctype. </p> </dd> <dt> <code>store_predefined</code></dt> <dd><a name="index-store_005fpredefined-MELT-syntax"></a> <p>[Expert] <code>(store_predefined <var>predef-name-or-number</var> <var>expr</var>)</code> Don’t use it if you don’t understand. </p> </dd> <dt> <code>tuple</code></dt> <dd><a name="index-tuple-MELT-syntax"></a> <p><code>(tuple <var>expr</var> <var>…</var>)</code> is a constructive expressions for tuples (or multiples). It returns a tuple made of the arguments. </p> </dd> <dt> <code>unsafe_get_field</code></dt> <dd><a name="index-unsafe_005fget_005ffield-MELT-syntax"></a> <p><code>(unsafe_get_field <var>:field-name</var> <var>expr</var>)</code> retrieves the field named <var>:field-name</var> from the object returned by <var>expr</var> expression (of ctype <code>:value</code>). If <var>expr</var> does not evaluates to an object instance (directly or indirectly) of the class defining the <var>:field-name</var> the behavior is undefined, and unsafe (GCC usually crashes). </p> </dd> <dt> <code>unsafe_put_fields</code></dt> <dd><a name="index-unsafe_005fput_005ffields-MELT-syntax"></a> <p><code>(unsafe_put_fields <var>obj</var> <var>:field-name1</var> <var>val1</var> <var>…</var>)</code> updates the object value of <var>obj</var> by changing its field named <var>:field-name1</var> to the value of <var>val1</var> etc… (all the fields are updated at once). If <var>obj</var> is not an object of the appropriate class for the fields, the behavior is undefined and unsafe (usually GCC crashes). </p> </dd> <dt> <code>update_current_module_environment_container</code></dt> <dd><a name="index-update_005fcurrent_005fmodule_005fenvironment_005fcontainer-MELT-syntax"></a> <p>[Expert] <code>(update_current_module_environment_container)</code> don’t use it if you don’t understand. </p> </dd> </dl> <hr size="6"> <a name="MELT-modules-and-translation"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#MELT-syntax-constructs" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#MELT-environments-and-bindings" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Reference-on-MELT" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="MELT-modules-and-translation-1"></a> <h3 class="subsection">1.7.3 MELT modules and translation</h3> <p>[for experts mostly; familiarity with the notions of bindings and environments is expected.] </p> <table class="menu" border="0" cellspacing="0"> <tr><td align="left" valign="top"><a href="#MELT-environments-and-bindings">1.7.3.1 MELT environments and bindings</a></td><td> </td><td align="left" valign="top"> </td></tr> <tr><td align="left" valign="top"><a href="#translating-a-MELT-module">1.7.3.2 translating a MELT module</a></td><td> </td><td align="left" valign="top"> </td></tr> <tr><td align="left" valign="top"><a href="#MELT-module-initialization-and-exports">1.7.3.3 MELT module initialization and exports</a></td><td> </td><td align="left" valign="top"> </td></tr> <tr><td align="left" valign="top"><a href="#MELT-translation-steps">1.7.3.4 MELT translation steps</a></td><td> </td><td align="left" valign="top"> </td></tr> </table> <hr size="6"> <a name="MELT-environments-and-bindings"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#MELT-modules-and-translation" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#translating-a-MELT-module" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#MELT-modules-and-translation" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="MELT-environments-and-bindings-1"></a> <h4 class="subsubsection">1.7.3.1 MELT environments and bindings</h4> <p>A MELT module uses previously available bindings (imported values, etc..) and provides its own bindings (exported values, etc..). Bindings are objects (of superclass <code>CLASS_ANY_BINDING</code>, e.g. of some class like <code>CLASS_VALUE_BINDING</code> <code>CLASS_MACRO_BINDING</code> <code>CLASS_PATMACRO_BINDING</code> <code>CLASS_INSTANCE_BINDING</code> etc…). Bindings are grouped in environments (themselves objects of class <code>CLASS_ENVIRONMENT</code>). Each environment is linked to its parent. So a MELT module is initialized in its parent module environment and gives its own module environment. </p> <p>Hence MELT environments are objects with a <code>env_bind</code> field (the object map of bindings), a <code>env_prev</code> field (the previous environment), etc… All bindings are objects with a <code>binder</code> field (the bound “name”, e.g. a symbol, used as the key in the binding map of environments). </p> <p>User MELT code is ordinarily not supposed to explicitly change environments and bindings (but they are changed implicitly at module initialization). </p> <hr size="6"> <a name="translating-a-MELT-module"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#MELT-environments-and-bindings" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#MELT-module-initialization-and-exports" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#MELT-modules-and-translation" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="translating-a-MELT-module-1"></a> <h4 class="subsubsection">1.7.3.2 translating a MELT module</h4> <a name="index-translation-of-MELT"></a> <p>A MELT file ‘<tt><var>foo</var>.melt</tt>’ [which can be viewed as defining the <var>foo</var> MELT module] is translated into a C source ‘<tt><var>foo</var>.c</tt>’ which is then compiled into a dynamically loadable shared library - usually ‘<tt><var>foo</var>.so</tt>’ on Linux. The translation to C is done using <code>cc1</code> or <code>gcc -c</code> with the <code>-fmelt-mode=translatefile -fmelt-arg=<var>foo</var>.melt -fmelt-secondarg=<var>foo</var>.c</code> options. The generated file <var>foo</var>.c is usually quite big (and only <code>#include</code>-ing one file, <code>"run-melt.h"</code> which includes all the rest). It essentially contains one static C function (of signature compatible with <code>melt_apply</code>) for each <code>defun</code> or <code>lambda</code> function in MELT, and one big exported <code>start_module_melt</code> C function which does all the initializations, and some other stuff. The initialization code builds all the required data (quoted symbols, closures, classes, fields, boxed strings, static instances defined thru <code>definstance</code> etc..); MELT modules have no data outside of this <code>start_module_melt</code> function. </p> <p>The start function <code>start_module_melt</code> (which is found by dynamic loading of the module, usually thru <code>dlopen</code> and <code>dlsym</code> or their equivalent, and called only once) expects a parent environment and returns the newly filled module environment<a name="DOCF5" href="#FOOT5">(5)</a>. </p> <p>To generate a MELT binary module from a MELT source file, use <code>-fmelt-mode=translatetomodule</code>. </p> <hr size="6"> <a name="MELT-module-initialization-and-exports"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#translating-a-MELT-module" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#MELT-translation-steps" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#MELT-modules-and-translation" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="MELT-module-initialization-and-exports-1"></a> <h4 class="subsubsection">1.7.3.3 MELT module initialization and exports</h4> <a name="index-modules-in-MELT"></a> <p>Names defined (as a function thru <code>defun</code>, as a class thru <code>defclass</code>, as a field, etc…) are not visible outside their module (to further MELT modules loaded afterwards) unless they are <em>exported</em>. Most names (e.g. functions, selectors, instances) are exported as values using the <code>export_values</code> construct. Classes are usually exported using <code>export_class</code><a name="DOCF6" href="#FOOT6">(6)</a>, which also exports all the own fields of the exported class (but inherited fields are not exported, unless their class was <code>export_class</code>-ed). </p> <p>Advanced users can extend the MELT language by exporting macros using the <code>export_macro</code> construct, which gets a macro name and its macro expander function, which takes as arguments the source expression (of <code>CLASS_SEXPR</code>), the environment (of <code>CLASS_ENVIRONMENT</code>), the current expander, and produces an instance of a subclass of <code>CLASS_SRC</code>. </p> <hr size="6"> <a name="MELT-translation-steps"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#MELT-module-initialization-and-exports" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#Writing-GCC-passes-in-MELT" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#MELT-modules-and-translation" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="MELT-translation-steps-1"></a> <h4 class="subsubsection">1.7.3.4 MELT translation steps</h4> <p>The generated C code is of much lower level than the MELT source. The MELT source code is usually in a file but can be elsewhere (a list or s-exprs in memory). </p> <p>The generated C code interacts with MELT runtime and garbage collector; in particular, every value -even temporary ones- should be explicitly stored in MELT frames known by the GC. Hence, MELT expressions are quickly normalized : <code>(f (g x) y)</code> becomes something similar to <i><b>let</b> gg = g x <b>in</b> f gg y</i><a name="DOCF7" href="#FOOT7">(7)</a> where <i>gg</i> is a fresh variable (actually an instance of <code>CLASS_CLONEDSYMBOL</code>). </p> <a name="index-reader-in-MELT"></a> <a name="index-s_002dexpression-in-MELT"></a> <p>The <em>reader</em>, or some other source, provides a list of s-expressions to be translated. Each such s-expression is an instance of <code>CLASS_SEXPR</code> so has <code>prop_table loca_location sexp_contents</code> as fields. The <code>:loca_location</code> field is a mixloc giving the staring position and file of the s-expr. The <code>:sexp_contents</code> is a list value containing the s-expression elements. Leafs are read specifically, e.g. boxed integers (of <code>DISCR_INTEGER</code>) for integers, or symbols (instances of <code>CLASS_SYMBOL</code>) or keywords (instances of <code>CLASS_KEYWORD</code>, etc. All these classes are defined in ‘<tt>warmelt-first.melt</tt>’. </p> <a name="index-macro_002dexpansion-in-MELT"></a> <p>Then s-expressions are <em>macro-expanded</em> into objects of subclasses of <code>CLASS_SRC</code>. Standard macros (in particular all the constructs defined above, see section <a href="#MELT-syntax-constructs">MELT syntax constructs</a>.) are defined in ‘<tt>warmelt-macro.melt</tt>’. For instance, the <code>if</code> macro is expanded by the <code>mexpand_if</code> expander function (private to ‘<tt>warmelt-macro.melt</tt>’) which makes an instance of <code>CLASS_SRC_IFELSE</code> with fields <code>:src_loc sif_test :sif_then :sif_else</code> and this <code>mexpand_if</code> expander is given to <code>export_macro</code>. Macro expanders might need some of <code>expand_apply lambda_arg_bindings macroexpand_1</code> … functions defined in ‘<tt>warmelt-macro.melt</tt>’. </p> <a name="index-normalization-in-MELT"></a> <a name="index-nrep-in-MELT"></a> <p>After macro-expansion, the expanded source code (instances of some subclass of <code>CLASS_SRC</code>) is <em>normalized</em> into instances of subclasses of <code>CLASS_NREP</code> (for normal representations, i.e. <em>nrep</em>s) by code in ‘<tt>warmelt-normal.melt</tt>’. Normal expressions are not nested, so we separate simple nreps from complex normal expressions (<code>CLASS_NREP_SIMPLE</code> vs <code>CLASS_NREP_EXPR</code>). Normalization means not only adding extra internal lets (i.e. instances of <code>CLASS_NREP_LET</code> but sometimes computing additional information, such as the ctype of many expressions. Normalization is in particular done with the <code>normal_exp</code> selector (returning the nrep primarily and secundarily a list of additional bindings), and other utilities such as <code>normalize_tuple get_ctype wrap_normal_letseq</code> etc… For instance the normalization of <code>if</code> constructs is done in the <code>normal_exp</code> method for <code>CLASS_SRC_IF</code>, in a private function called <code>normexp_if</code> which returns an instance of <code>CLASS_NREP_IF</code> with fields <code>:nrep_loc nif_test :nif_then :nif_else :nif_ctyp</code> and a list of additional normal bindings (of <code>CLASS_NORMLET_BINDING</code>). Macro-expansion and normalization sometimes give simpler representations; e.g. all of <code>if and or</code> constructs get normalized as instances of <code>CLASS_NREP_IF</code>. </p> <a name="index-code-generation-in-MELT"></a> <a name="index-objcode-in-MELT"></a> <p>After normalization, nreps (which are expression-like) are transformed in the “code generation”<a name="DOCF8" href="#FOOT8">(8)</a> step into instruction-like representations called <em>objcode</em>s . instances of subclasses of <code>CLASS_OBJCODE</code>. This happens in ‘<tt>warmelt-genobj.melt</tt>’ using the <code>compile_obj</code> selector, which, applied to nreps and a generation context (a merge of various info), produce objcodes. Moving from nreps expressions to instructions involve very often putting a destination on an nrep thru the <code>put_objdest</code> selector. </p> <a name="index-code-output-in-MELT"></a> <p>At last, the objcode is output, within the ‘<tt>warmelt-outobj.melt</tt>’ file, in two string-buffers (one for the header part, one for the body part) using several selectors like <code>output_c_code output_c_declinit output_c_initfill output_c_initpredef</code>. Only once all objcodes has been output in string buffers is it actually spilled to the generated C file, all at once. </p> <p>Advanced users can extend the MELT language by implementing extensions at various levels of the MELT translator. </p> <p>Several important data or functions are available thru the <code>initial_system_data</code> instance (the only instance of <code>CLASS_SYSTEM_DATA</code>), including the exporting and importing machinery, the fresh module environment maker, the symbols and keywords dictionnaries and internizers. </p> <p>All the MELT translation occur in ‘<tt>warmelt-*.melt</tt>’ files which generate their ‘<tt>warmelt-*.c</tt>’ counterparts (these generated files are distributed with GCC sources). Be careful to minimize the interaction between these files and the rest of GCC (in particular, avoid having a strong dependecies between GCC internal data representations - like <code>gimple</code>) to be able to regenerate the translating and translated files ‘<tt>warmelt-*.c</tt>’ from ‘<tt>warmelt-*.melt</tt>’ even when GCC internal passes evolve<a name="DOCF9" href="#FOOT9">(9)</a>. </p> <hr size="6"> <a name="Writing-GCC-passes-in-MELT"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#MELT-translation-steps" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#Writing-C-code-for-MELT" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Reference-on-MELT" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="Writing-GCC-passes-in-MELT-1"></a> <h3 class="subsection">1.7.4 Writing GCC passes in MELT</h3> <p>[For experts, knowing about GCC passes in general] </p> <p>GCC passes can be written in MELT. See the ‘<tt>ana-*.melt</tt>’ files. </p> <hr size="6"> <a name="Writing-C-code-for-MELT"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Writing-GCC-passes-in-MELT" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#MELT" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Funding" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="Writing-C-code-for-MELT-1"></a> <h2 class="section">1.8 Writing C code for MELT</h2> <p>[For experts] Sometimes (i.e. to implement a new primitive) it may be necessary to write some C code for MELT. We describe here the coding conventions to follow, in particular because MELT has a copying generational garbage collector (which changes pointers when copying values out of the nursery). </p> <p>Above all, <em>avoid coding in C</em> (a cumbersome task) and <em>prefer writing MELT code</em> when possible. </p> <p>Remember that MELT pointers can move at every allocation and every MELT related call. </p> <p>First, a real example. To box a long integer into a MELT value, MELT code have to use the <code>make_integerbox</code> defined in ‘<tt>warmelt-first.melt</tt>’ as </p><table><tr><td> </td><td><pre class="lisp">(defprimitive make_integerbox (discr :long n) :value #{(meltgc_new_int((meltobject_ptr_t)(" discr "), (" n ")))}# </pre></td></tr></table> <p>If the passed <code>discr</code> is not a discriminant for boxed integers, <code>make_integerbox</code> gives nil. </p> <p>To get the boxed integer’s content, use the <code>getint</code> primitive in MELT. To test if a value is a boxed integer, use the <code>is_integerbox</code> primitive. </p> <p>The <code>meltgc_new_int</code> routine is implemented in ‘<tt>melt.c</tt>’ with the following code. We give it entirely, with additional comments </p> <pre class="verbatim">melt_ptr_t meltgc_new_int (meltobject_ptr_t discr_p, long num) { MELT_ENTERFRAME (2, NULL); #define newintv curfram__.varptr[0] #define discrv curfram__.varptr[1] #define object_discrv ((meltobject_ptr_t)(discrv)) #define int_newintv ((struct meltint_st*)(newintv)) </pre><p>We first create a MELT frame using the <code>MELT_ENTERFRAME</code> macro which creates, initialize the frame and install it at top. The first argument is the number of local MELT values, the second argument is the current MELT closure (so is <code>NULL</code> for C code which is not the code of a routine). Instead of writing <code>curfram__.varptr[0]</code> we <code>#define</code> some more descriptive names for readability. The frame is initially filled with nil values. The value pointer arguments (here <code>discr_p</code>) of the C function are conventionally named with a <code>_p</code> suffix. Every local MELT value should be inside your <code>curfram__.varptr</code> array. </p> <pre class="verbatim"> discrv = (void *) discr_p; </pre><p>Every value passed as a C argument should be immediately copied into the MELT frame (i.e. as a local value) and the C argument should not be used directly afterwards. So never use <code>_p</code> suffixed arguments after have copied them inside the frame. </p> <pre class="verbatim"> if (melt_magic_discr ((melt_ptr_t) (discrv)) != OBMAG_OBJECT) goto end; if (object_discrv->object_magic != OBMAG_INT) goto end; </pre><p>We try to be safe, so we at least test that the discriminant is an object. We could have tested that it is indeed an instance of <code>CLASS_DISCR</code> but that would be slower but safer. However we do test that the discriminant’s magic is indeed <code>OBMAG_INT</code><a name="DOCF10" href="#FOOT10">(10)</a>. If either test fail, we return nil by <code>goto end</code>. We cannot code a direct <code>return</code> statement, because that would not pop the topmost MELT frame. </p> <pre class="verbatim"> newintv = meltgc_allocate (sizeof (struct meltint_st), 0); int_newintv->discr = object_discrv; int_newintv->val = num; </pre><p>We allocate space in the nursery with <code>meltgc_allocate</code>. This C function sometimes trigger MELT garbage collection, so may move any pointer inside any MELT frames. The first argument to <code>meltgc_allocate</code> is the <code>sizeof</code> of the fixed part of the value, and the second is the size of its trailing variable part. The allocated zone should be immediately filled to make a valid MELT value. </p> <pre class="verbatim">end: MELT_EXITFRAME (); return (melt_ptr_t) newintv; #undef newintv #undef discrv #undef int_newintv #undef object_discrv } </pre><p>We end by popping the current MELT frame and retuning. Popping the frame should always be done, so conventionally we use an <code>end:</code> label. To be good citizens for further C functions, we <code>#undef</code>-ing every C macro defined for readability. </p> <p>More generally, every C function which may (directly or in any deeply called function) trigger the MELT garbage collector should follow these rules: </p> <ol> <li> avoid coding in C. The whole purpose of MELT is to make coding more fun. </li><li> make an explicit MELT frame and enter it. The C routine should start by making a frame usually with <code>MELT_ENTERFRAME</code> macro (which expands to a C declaration followed by some C statements, so should be the last “declaration” like stuff in your function). For readability, you want to define C macros (conventionally ending with <code>v</code>) to access the local values in your frame instead of <code>curfram__.varptr[<var>index</var>]</code>. </li><li> put every value in the MELT frame. This means that every value should be kept in a local inside the MELT frame, accessed thru <code>curfram__</code>. In particular, <em>nesting function calls is prohibited</em>; never code <code>f(g(x))</code> if <code>g</code> may trigger a MELT garbage collection; use a local value for <code>g(x)</code> instead, and avoid declaring any MELT value as a C local. </li><li> try to code safely. Unless you have specific reasons to avoid that, try to test MELT values before using them. </li><li> notify on MELT updates. When a MELT value is updated by changing some MELT pointer inside it, you have to notify the garbage collector (write barrier) using the <code>meltgc_touch</code> function (taking as argument the modified MELT value) or the <code>meltgc_touch_dest</code> (also given the new MELT pointer inside). These functions has to be called just after writing the MELT pointer into the data. They can call the MELT garbage collector (which may change any local value in the MELT frame). </li><li> allocate MELT data appropriately. Use <code>meltgc_allocate</code>, or preferably some existing allocating function (like <code>meltgc_new_*</code>) to allocate new MELT values. Never forget that such an allocation may trigger the MELT GC and change every local pointer in the current MELT frame <code>curfram__</code>. Most C functions which may directly or indirectly trigger a MELT garbage collection are prefixed with <code>meltgc</code> (but <code>melt_apply</code> could also trigger that). </li><li> don’t use longjmp, because <code>longjmp</code> won’t pop the MELT frames. </li><li> always exit the MELT frame explicitly using <code>MELT_EXITFRAME()</code> macro, which usually is the last statement of your function (so avoid <code>return</code>-ing before, hence always use a <code>goto end</code> instead. </li><li> avoid using global MELT values. If you really need some, use the <code>MELTGOB</code> or <code>MELTG</code> macros. Adding additional MELT globals is tricky (edit files ‘<tt>melt.h</tt>’ and ‘<tt>warmelt-normal.melt</tt>’). Using existing MELT globals is simpler, e.g. <code>MELTGOB(DISCR_LIST)</code> to fetch the predefined discriminant <code>DISCR_LIST</code>. </li><li> apply MELT functions and send MELT messages using <code>melt_apply</code> and <code>meltgc_send</code> with their pecular calling conventions (constant string describing array of unions). </li></ol> <hr size="6"> <a name="Funding"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Writing-C-code-for-MELT" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#GNU-Project" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#GNU-Project" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="Funding-Free-Software"></a> <h1 class="unnumbered">Funding Free Software</h1> <p>If you want to have more free software a few years from now, it makes sense for you to help encourage people to contribute funds for its development. The most effective approach known is to encourage commercial redistributors to donate. </p> <p>Users of free software systems can boost the pace of development by encouraging for-a-fee distributors to donate part of their selling price to free software developers—the Free Software Foundation, and others. </p> <p>The way to convince distributors to do this is to demand it and expect it from them. So when you compare distributors, judge them partly by how much they give to free software development. Show distributors they must compete to be the one who gives the most. </p> <p>To make this approach work, you must insist on numbers that you can compare, such as, “We will donate ten dollars to the Frobnitz project for each disk sold.” Don’t be satisfied with a vague promise, such as “A portion of the profits are donated,” since it doesn’t give a basis for comparison. </p> <p>Even a precise fraction “of the profits from this disk” is not very meaningful, since creative accounting and unrelated business decisions can greatly alter what fraction of the sales price counts as profit. If the price you pay is $50, ten percent of the profit is probably less than a dollar; it might be a few cents, or nothing at all. </p> <p>Some redistributors do development work themselves. This is useful too; but to keep everyone honest, you need to inquire how much they do, and what kind. Some kinds of development make much more long-term difference than others. For example, maintaining a separate version of a program contributes very little; maintaining the standard version of a program for the whole community contributes much. Easy new ports contribute little, since someone else would surely do them; difficult ports such as adding a new CPU to the GNU Compiler Collection contribute more; major new features or packages contribute the most. </p> <p>By establishing the idea that supporting further development is “the proper thing to do” when distributing free software for a fee, we can assure a steady flow of resources into making more free software. </p> <table><tr><td> </td><td><pre class="display">Copyright © 1994 Free Software Foundation, Inc. Verbatim copying and redistribution of this section is permitted without royalty; alteration is not permitted. </pre></td></tr></table> <hr size="6"> <a name="GNU-Project"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Funding" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#Copying" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Funding" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Copying" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="The-GNU-Project-and-GNU_002fLinux"></a> <h1 class="unnumbered">The GNU Project and GNU/Linux</h1> <p>The GNU Project was launched in 1984 to develop a complete Unix-like operating system which is free software: the GNU system. (GNU is a recursive acronym for “GNU’s Not Unix”; it is pronounced “guh-NEW”.) Variants of the GNU operating system, which use the kernel Linux, are now widely used; though these systems are often referred to as “Linux”, they are more accurately called GNU/Linux systems. </p> <p>For more information, see: </p><table><tr><td> </td><td><pre class="smallexample"><a href="http://www.gnu.org/">http://www.gnu.org/</a> <a href="http://www.gnu.org/gnu/linux-and-gnu.html">http://www.gnu.org/gnu/linux-and-gnu.html</a> </pre></td></tr></table> <hr size="6"> <a name="Copying"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#GNU-Project" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#GNU-Free-Documentation-License" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#GNU-Project" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#GNU-Free-Documentation-License" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="GNU-General-Public-License"></a> <h1 class="unnumbered">GNU General Public License</h1> <p align="center"> Version 3, 29 June 2007 </p> <table><tr><td> </td><td><pre class="display">Copyright © 2007 Free Software Foundation, Inc. <a href="http://fsf.org/">http://fsf.org/</a> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. </pre></td></tr></table> <a name="Preamble"></a> <h2 class="heading">Preamble</h2> <p>The GNU General Public License is a free, copyleft license for software and other kinds of works. </p> <p>The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program–to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. </p> <p>When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. </p> <p>To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. </p> <p>For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. </p> <p>Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. </p> <p>For the developers’ and authors’ protection, the GPL clearly explains that there is no warranty for this free software. For both users’ and authors’ sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. </p> <p>Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users’ freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. </p> <p>Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. </p> <p>The precise terms and conditions for copying, distribution and modification follow. </p> <a name="TERMS-AND-CONDITIONS"></a> <h2 class="heading">TERMS AND CONDITIONS</h2> <ol> <li> Definitions. <p>“This License” refers to version 3 of the GNU General Public License. </p> <p>“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. </p> <p>“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations. </p> <p>To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work. </p> <p>A “covered work” means either the unmodified Program or a work based on the Program. </p> <p>To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. </p> <p>To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. </p> <p>An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. </p> </li><li> Source Code. <p>The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work. </p> <p>A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. </p> <p>The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. </p> <p>The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work’s System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. </p> <p>The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. </p> <p>The Corresponding Source for a work in source code form is that same work. </p> </li><li> Basic Permissions. <p>All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. </p> <p>You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. </p> <p>Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. </p> </li><li> Protecting Users’ Legal Rights From Anti-Circumvention Law. <p>No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. </p> <p>When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work’s users, your or third parties’ legal rights to forbid circumvention of technological measures. </p> </li><li> Conveying Verbatim Copies. <p>You may convey verbatim copies of the Program’s source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. </p> <p>You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. </p> </li><li> Conveying Modified Source Versions. <p>You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: </p> <ol> <li> The work must carry prominent notices stating that you modified it, and giving a relevant date. </li><li> The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”. </li><li> You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. </li><li> If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. </li></ol> <p>A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation’s users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. </p> </li><li> Conveying Non-Source Forms. <p>You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: </p> <ol> <li> Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. </li><li> Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. </li><li> Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. </li><li> Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. </li><li> Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. </li></ol> <p>A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. </p> <p>A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. </p> <p>“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. </p> <p>If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). </p> <p>The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. </p> <p>Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. </p> </li><li> Additional Terms. <p>“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. </p> <p>When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. </p> <p>Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: </p> <ol> <li> Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or </li><li> Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or </li><li> Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or </li><li> Limiting the use for publicity purposes of names of licensors or authors of the material; or </li><li> Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or </li><li> Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. </li></ol> <p>All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. </p> <p>If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. </p> <p>Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. </p> </li><li> Termination. <p>You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). </p> <p>However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. </p> <p>Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. </p> <p>Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. </p> </li><li> Acceptance Not Required for Having Copies. <p>You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. </p> </li><li> Automatic Licensing of Downstream Recipients. <p>Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. </p> <p>An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party’s predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. </p> <p>You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. </p> </li><li> Patents. <p>A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor’s “contributor version”. </p> <p>A contributor’s “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. </p> <p>Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor’s essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. </p> <p>In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. </p> <p>If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient’s use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. </p> <p>If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. </p> <p>A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. </p> <p>Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. </p> </li><li> No Surrender of Others’ Freedom. <p>If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. </p> </li><li> Use with the GNU Affero General Public License. <p>Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. </p> </li><li> Revised Versions of this License. <p>The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. </p> <p>Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. </p> <p>If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy’s public statement of acceptance of a version permanently authorizes you to choose that version for the Program. </p> <p>Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. </p> </li><li> Disclaimer of Warranty. <p>THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. </p> </li><li> Limitation of Liability. <p>IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. </p> </li><li> Interpretation of Sections 15 and 16. <p>If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. </p> </li></ol> <a name="END-OF-TERMS-AND-CONDITIONS"></a> <h2 class="heading">END OF TERMS AND CONDITIONS</h2> <a name="How-to-Apply-These-Terms-to-Your-New-Programs"></a> <h2 class="heading">How to Apply These Terms to Your New Programs</h2> <p>If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. </p> <p>To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found. </p> <table><tr><td> </td><td><pre class="smallexample"><var>one line to give the program's name and a brief idea of what it does.</var> Copyright (C) <var>year</var> <var>name of author</var> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>. </pre></td></tr></table> <p>Also add information on how to contact you by electronic and paper mail. </p> <p>If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: </p> <table><tr><td> </td><td><pre class="smallexample"><var>program</var> Copyright (C) <var>year</var> <var>name of author</var> This program comes with ABSOLUTELY NO WARRANTY; for details type ‘<samp>show w</samp>’. This is free software, and you are welcome to redistribute it under certain conditions; type ‘<samp>show c</samp>’ for details. </pre></td></tr></table> <p>The hypothetical commands ‘<samp>show w</samp>’ and ‘<samp>show c</samp>’ should show the appropriate parts of the General Public License. Of course, your program’s commands might be different; for a GUI interface, you would use an “about box”. </p> <p>You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>. </p> <p>The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <a href="http://www.gnu.org/philosophy/why-not-lgpl.html">http://www.gnu.org/philosophy/why-not-lgpl.html</a>. </p> <hr size="6"> <a name="GNU-Free-Documentation-License"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Copying" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#ADDENDUM_003a-How-to-use-this-License-for-your-documents" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Copying" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="GNU-Free-Documentation-License-1"></a> <h1 class="unnumbered">GNU Free Documentation License</h1> <a name="index-FDL_002c-GNU-Free-Documentation-License"></a> <p align="center"> Version 1.3, 3 November 2008 </p> <table><tr><td> </td><td><pre class="display">Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. <a href="http://fsf.org/">http://fsf.org/</a> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. </pre></td></tr></table> <ol> <li> PREAMBLE <p>The purpose of this License is to make a manual, textbook, or other functional and useful document <em>free</em> in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others. </p> <p>This License is a kind of “copyleft”, which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software. </p> <p>We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference. </p> </li><li> APPLICABILITY AND DEFINITIONS <p>This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The “Document”, below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as “you”. You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law. </p> <p>A “Modified Version” of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language. </p> <p>A “Secondary Section” is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document’s overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them. </p> <p>The “Invariant Sections” are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none. </p> <p>The “Cover Texts” are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words. </p> <p>A “Transparent” copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not “Transparent” is called “Opaque”. </p> <p>Examples of suitable formats for Transparent copies include plain <small>ASCII</small> without markup, Texinfo input format, LaTeX input format, <acronym>SGML</acronym> or <acronym>XML</acronym> using a publicly available <acronym>DTD</acronym>, and standard-conforming simple <acronym>HTML</acronym>, PostScript or <acronym>PDF</acronym> designed for human modification. Examples of transparent image formats include <acronym>PNG</acronym>, <acronym>XCF</acronym> and <acronym>JPG</acronym>. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, <acronym>SGML</acronym> or <acronym>XML</acronym> for which the <acronym>DTD</acronym> and/or processing tools are not generally available, and the machine-generated <acronym>HTML</acronym>, PostScript or <acronym>PDF</acronym> produced by some word processors for output purposes only. </p> <p>The “Title Page” means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, “Title Page” means the text near the most prominent appearance of the work’s title, preceding the beginning of the body of the text. </p> <p>The “publisher” means any person or entity that distributes copies of the Document to the public. </p> <p>A section “Entitled XYZ” means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.) To “Preserve the Title” of such a section when you modify the Document means that it remains a section “Entitled XYZ” according to this definition. </p> <p>The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License. </p> </li><li> VERBATIM COPYING <p>You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3. </p> <p>You may also lend copies, under the same conditions stated above, and you may publicly display copies. </p> </li><li> COPYING IN QUANTITY <p>If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document’s license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects. </p> <p>If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages. </p> <p>If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public. </p> <p>It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document. </p> </li><li> MODIFICATIONS <p>You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version: </p> <ol> <li> Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission. </li><li> List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement. </li><li> State on the Title page the name of the publisher of the Modified Version, as the publisher. </li><li> Preserve all the copyright notices of the Document. </li><li> Add an appropriate copyright notice for your modifications adjacent to the other copyright notices. </li><li> Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below. </li><li> Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document’s license notice. </li><li> Include an unaltered copy of this License. </li><li> Preserve the section Entitled “History”, Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled “History” in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence. </li><li> Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the “History” section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission. </li><li> For any section Entitled “Acknowledgements” or “Dedications”, Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein. </li><li> Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles. </li><li> Delete any section Entitled “Endorsements”. Such a section may not be included in the Modified Version. </li><li> Do not retitle any existing section to be Entitled “Endorsements” or to conflict in title with any Invariant Section. </li><li> Preserve any Warranty Disclaimers. </li></ol> <p>If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version’s license notice. These titles must be distinct from any other section titles. </p> <p>You may add a section Entitled “Endorsements”, provided it contains nothing but endorsements of your Modified Version by various parties—for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard. </p> <p>You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one. </p> <p>The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version. </p> </li><li> COMBINING DOCUMENTS <p>You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers. </p> <p>The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work. </p> <p>In the combination, you must combine any sections Entitled “History” in the various original documents, forming one section Entitled “History”; likewise combine any sections Entitled “Acknowledgements”, and any sections Entitled “Dedications”. You must delete all sections Entitled “Endorsements.” </p> </li><li> COLLECTIONS OF DOCUMENTS <p>You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects. </p> <p>You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document. </p> </li><li> AGGREGATION WITH INDEPENDENT WORKS <p>A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an “aggregate” if the copyright resulting from the compilation is not used to limit the legal rights of the compilation’s users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document. </p> <p>If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document’s Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate. </p> </li><li> TRANSLATION <p>Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail. </p> <p>If a section in the Document is Entitled “Acknowledgements”, “Dedications”, or “History”, the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title. </p> </li><li> TERMINATION <p>You may not copy, modify, sublicense, or distribute the Document except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License. </p> <p>However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. </p> <p>Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. </p> <p>Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it. </p> </li><li> FUTURE REVISIONS OF THIS LICENSE <p>The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See <a href="http://www.gnu.org/copyleft/">http://www.gnu.org/copyleft/</a>. </p> <p>Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License “or any later version” applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy’s public statement of acceptance of a version permanently authorizes you to choose that version for the Document. </p> </li><li> RELICENSING <p>“Massive Multiauthor Collaboration Site” (or “MMC Site”) means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. A “Massive Multiauthor Collaboration” (or “MMC”) contained in the site means any set of copyrightable works thus published on the MMC site. </p> <p>“CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization. </p> <p>“Incorporate” means to publish or republish a Document, in whole or in part, as part of another Document. </p> <p>An MMC is “eligible for relicensing” if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to November 1, 2008. </p> <p>The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing. </p> </li></ol> <hr size="6"> <a name="ADDENDUM_003a-How-to-use-this-License-for-your-documents"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#GNU-Free-Documentation-License" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#GNU-Free-Documentation-License" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#GNU-Free-Documentation-License" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <h2 class="unnumberedsec">ADDENDUM: How to use this License for your documents</h2> <p>To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page: </p> <table><tr><td> </td><td><pre class="smallexample"> Copyright (C) <var>year</var> <var>your name</var>. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''. </pre></td></tr></table> <p>If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the “with...Texts.” line with this: </p> <table><tr><td> </td><td><pre class="smallexample"> with the Invariant Sections being <var>list their titles</var>, with the Front-Cover Texts being <var>list</var>, and with the Back-Cover Texts being <var>list</var>. </pre></td></tr></table> <p>If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation. </p> <p>If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software. </p> <hr size="6"> <a name="MELT-Option-Index"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#ADDENDUM_003a-How-to-use-this-License-for-your-documents" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#MELT-Concept-Index" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#GNU-Free-Documentation-License" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#MELT-Concept-Index" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="MELT-Option-Index-1"></a> <h1 class="unnumbered">MELT Option Index</h1> <p>MELT plugin’s command line options are indexed here without any initial ‘<samp>-</samp>’ or ‘<samp>--</samp>’. Where an option has both positive and negative forms (such as ‘<samp>-f<var>option</var></samp>’ and ‘<samp>-fno-<var>option</var></samp>’), relevant entries in the manual are indexed under the most appropriate form; it may sometimes be useful to look up both forms. Each option has a plugin form ‘<samp>-fplugin-melt-arg-<var>option</var></samp>’ and a MELT branch form ‘<samp>-fmelt-<var>option</var></samp>’ which is used in the GCC experimental MELT branch. </p> <table><tr><th valign="top">Jump to: </th><td><a href="#MELT-Option-Index-1_op_letter-F" class="summary-letter"><b>F</b></a> </td></tr></table> <table border="0" class="index-op"> <tr><td></td><th align="left">Index Entry</th><th align="left"> Section</th></tr> <tr><td colspan="3"> <hr></td></tr> <tr><th><a name="MELT-Option-Index-1_op_letter-F">F</a></th><td></td><td></td></tr> <tr><td></td><td valign="top"><a href="#index-fmelt_002darg_003d"><code>fmelt-arg=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fmelt_002darglist_003d"><code>fmelt-arglist=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fmelt_002dcoutput_003d"><code>fmelt-coutput=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fmelt_002dcoutput_003d-1"><code>fmelt-coutput=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fmelt_002ddebug"><code>fmelt-debug</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fmelt_002ddebugskip_003d"><code>fmelt-debugskip=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fmelt_002dextra_003d"><code>fmelt-extra=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fmelt_002dinit_003d"><code>fmelt-init=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fmelt_002dmode"><code>fmelt-mode</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fmelt_002dmodule_002dcflags_003d"><code>fmelt-module-cflags=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fmelt_002dmodule_002dmake_002dcommand_003d"><code>fmelt-module-make-command=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fmelt_002dmodule_002dmakefile_003d"><code>fmelt-module-makefile=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fmelt_002dmodule_002dpath_003d"><code>fmelt-module-path=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fmelt_002doption_003d"><code>fmelt-option=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fmelt_002dprint_002dsettings_003d"><code>fmelt-print-settings=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fmelt_002dsource_002dpath_003d"><code>fmelt-source-path=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fmelt_002dtempdir_003d"><code>fmelt-tempdir=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fmelt_002dworkdir_003d"><code>fmelt-workdir=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fplugin_002darg_002dmelt_002darglist_003d"><code>fplugin-arg-melt-arglist=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fplugin_002darg_002dmelt_002dcflags_003d"><code>fplugin-arg-melt-cflags=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fplugin_002darg_002dmelt_002dcoutput_003d"><code>fplugin-arg-melt-coutput=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fplugin_002darg_002dmelt_002ddebug"><code>fplugin-arg-melt-debug</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fplugin_002darg_002dmelt_002ddebugskip_003d"><code>fplugin-arg-melt-debugskip=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fplugin_002darg_002dmelt_002dextra_003d"><code>fplugin-arg-melt-extra=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fplugin_002darg_002dmelt_002dinit_003d"><code>fplugin-arg-melt-init=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fplugin_002darg_002dmelt_002dmake_002dcommand_003d"><code>fplugin-arg-melt-make-command=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fplugin_002darg_002dmelt_002dmakefile_003d"><code>fplugin-arg-melt-makefile=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fplugin_002darg_002dmelt_002dmelt_002dtempdir_003d"><code>fplugin-arg-melt-melt-tempdir=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fplugin_002darg_002dmelt_002dmelt_002dworkdir_003d"><code>fplugin-arg-melt-melt-workdir=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fplugin_002darg_002dmelt_002dmode"><code>fplugin-arg-melt-mode</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fplugin_002darg_002dmelt_002dmodule_002dpath_003d"><code>fplugin-arg-melt-module-path=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fplugin_002darg_002dmelt_002doutput_003d"><code>fplugin-arg-melt-output=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fplugin_002darg_002dmelt_002dprint_002dsettings_003d"><code>fplugin-arg-melt-print-settings=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fplugin_002darg_002dmelt_002dsource_002dpath_003d"><code>fplugin-arg-melt-source-path=</code></a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td colspan="3"> <hr></td></tr> </table> <table><tr><th valign="top">Jump to: </th><td><a href="#MELT-Option-Index-1_op_letter-F" class="summary-letter"><b>F</b></a> </td></tr></table> <hr size="6"> <a name="MELT-Concept-Index"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[ > ]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[ >> ]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <a name="MELT-Concept-Index-1"></a> <h1 class="unnumbered">MELT Concept Index</h1> <table><tr><th valign="top">Jump to: </th><td><a href="#MELT-Concept-Index-1_cp_letter-A" class="summary-letter"><b>A</b></a> <a href="#MELT-Concept-Index-1_cp_letter-B" class="summary-letter"><b>B</b></a> <a href="#MELT-Concept-Index-1_cp_letter-C" class="summary-letter"><b>C</b></a> <a href="#MELT-Concept-Index-1_cp_letter-D" class="summary-letter"><b>D</b></a> <a href="#MELT-Concept-Index-1_cp_letter-E" class="summary-letter"><b>E</b></a> <a href="#MELT-Concept-Index-1_cp_letter-F" class="summary-letter"><b>F</b></a> <a href="#MELT-Concept-Index-1_cp_letter-G" class="summary-letter"><b>G</b></a> <a href="#MELT-Concept-Index-1_cp_letter-I" class="summary-letter"><b>I</b></a> <a href="#MELT-Concept-Index-1_cp_letter-L" class="summary-letter"><b>L</b></a> <a href="#MELT-Concept-Index-1_cp_letter-M" class="summary-letter"><b>M</b></a> <a href="#MELT-Concept-Index-1_cp_letter-N" class="summary-letter"><b>N</b></a> <a href="#MELT-Concept-Index-1_cp_letter-O" class="summary-letter"><b>O</b></a> <a href="#MELT-Concept-Index-1_cp_letter-P" class="summary-letter"><b>P</b></a> <a href="#MELT-Concept-Index-1_cp_letter-Q" class="summary-letter"><b>Q</b></a> <a href="#MELT-Concept-Index-1_cp_letter-R" class="summary-letter"><b>R</b></a> <a href="#MELT-Concept-Index-1_cp_letter-S" class="summary-letter"><b>S</b></a> <a href="#MELT-Concept-Index-1_cp_letter-T" class="summary-letter"><b>T</b></a> <a href="#MELT-Concept-Index-1_cp_letter-U" class="summary-letter"><b>U</b></a> <a href="#MELT-Concept-Index-1_cp_letter-V" class="summary-letter"><b>V</b></a> </td></tr></table> <table border="0" class="index-cp"> <tr><td></td><th align="left">Index Entry</th><th align="left"> Section</th></tr> <tr><td colspan="3"> <hr></td></tr> <tr><th><a name="MELT-Concept-Index-1_cp_letter-A">A</a></th><td></td><td></td></tr> <tr><td></td><td valign="top"><a href="#index-and-MELT-syntax"><code>and</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-assert_005ffailed-MELT-primitive"><code>assert_failed</code> MELT primitive</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-assert_005fmsg-MELT-syntax"><code>assert_msg</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td colspan="3"> <hr></td></tr> <tr><th><a name="MELT-Concept-Index-1_cp_letter-B">B</a></th><td></td><td></td></tr> <tr><td></td><td valign="top"><a href="#index-box-MELT-value">box MELT value</a></td><td valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td></tr> <tr><td></td><td valign="top"><a href="#index-boxed-ctype-map-MELT-value">boxed ctype map MELT value</a></td><td valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td></tr> <tr><td></td><td valign="top"><a href="#index-boxed-ctype-MELT-value">boxed ctype MELT value</a></td><td valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td></tr> <tr><td></td><td valign="top"><a href="#index-boxed-values-in-MELT">boxed values in MELT</a></td><td valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td></tr> <tr><td></td><td valign="top"><a href="#index-Building-the-MELT-branch">Building the MELT branch</a></td><td valign="top"><a href="#Building-the-MELT-branch">1.3 Building the MELT branch</a></td></tr> <tr><td colspan="3"> <hr></td></tr> <tr><th><a name="MELT-Concept-Index-1_cp_letter-C">C</a></th><td></td><td></td></tr> <tr><td></td><td valign="top"><a href="#index-Citerator-in-MELT">Citerator in MELT</a></td><td valign="top"><a href="#Citerators-in-MELT">1.6.3 Citerators in MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-class-in-MELT">class in MELT</a></td><td valign="top"><a href="#MELT-objects-and-classes">1.7.2.4 MELT objects and classes</a></td></tr> <tr><td></td><td valign="top"><a href="#index-closure-MELT-value">closure MELT value</a></td><td valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td></tr> <tr><td></td><td valign="top"><a href="#index-code-generation-in-MELT">code generation in MELT</a></td><td valign="top"><a href="#MELT-translation-steps">1.7.3.4 MELT translation steps</a></td></tr> <tr><td></td><td valign="top"><a href="#index-code-output-in-MELT">code output in MELT</a></td><td valign="top"><a href="#MELT-translation-steps">1.7.3.4 MELT translation steps</a></td></tr> <tr><td></td><td valign="top"><a href="#index-comment-MELT-syntax"><code>comment</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-compile_005fwarning-MELT-syntax"><code>compile_warning</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-cond-MELT-syntax"><code>cond</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-cppif-MELT-syntax"><code>cppif</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-ctype-in-MELT">ctype in MELT</a></td><td valign="top"><a href="#Primitives-in-MELT">1.6.2 Primitives in MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-ctype-in-MELT-1">ctype in MELT</a></td><td valign="top"><a href="#MELT-ctypes">1.7.2.2 MELT ctypes</a></td></tr> <tr><td></td><td valign="top"><a href="#index-ctype-MELT-keyword">ctype MELT keyword</a></td><td valign="top"><a href="#MELT-formals">1.7.2.1 MELT formals</a></td></tr> <tr><td></td><td valign="top"><a href="#index-current_005fmodule_005fenvironment_005fcontainer-MELT-syntax"><code>current_module_environment_container</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td colspan="3"> <hr></td></tr> <tr><th><a name="MELT-Concept-Index-1_cp_letter-D">D</a></th><td></td><td></td></tr> <tr><td></td><td valign="top"><a href="#index-debug_005fmsg-MELT-syntax"><code>debug_msg</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-defciterator-MELT-syntax"><code>defciterator</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-defclass-MELT-syntax"><code>defclass</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-defcmatcher-MELT-syntax_002e"><code>defcmatcher</code> MELT syntax.</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-definstance-MELT-syntax"><code>definstance</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-defprimitive-MELT-syntax"><code>defprimitive</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-defselector-MELT-syntax"><code>defselector</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-defun-MELT-syntax"><code>defun</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-discriminant-for-MELT-values">discriminant for MELT values</a></td><td valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td></tr> <tr><td colspan="3"> <hr></td></tr> <tr><th><a name="MELT-Concept-Index-1_cp_letter-E">E</a></th><td></td><td></td></tr> <tr><td></td><td valign="top"><a href="#index-exit-MELT-syntax"><code>exit</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-export_005fclass-MELT-syntax"><code>export_class</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-export_005fmacro-MELT-syntax"><code>export_macro</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-export_005fpatmacro-MELT-syntax"><code>export_patmacro</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-export_005fvalues-MELT-syntax"><code>export_values</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td colspan="3"> <hr></td></tr> <tr><th><a name="MELT-Concept-Index-1_cp_letter-F">F</a></th><td></td><td></td></tr> <tr><td></td><td valign="top"><a href="#index-FDL_002c-GNU-Free-Documentation-License">FDL, GNU Free Documentation License</a></td><td valign="top"><a href="#GNU-Free-Documentation-License">GNU Free Documentation License</a></td></tr> <tr><td></td><td valign="top"><a href="#index-fetch_005fpredefined-MELT-syntax"><code>fetch_predefined</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-forever-MELT-syntax"><code>forever</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-full-MELT-garbage-collection">full MELT garbage collection</a></td><td valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td></tr> <tr><td></td><td valign="top"><a href="#index-Function-in-MELT">Function in MELT</a></td><td valign="top"><a href="#Functions-in-MELT">1.6.4 Functions in MELT</a></td></tr> <tr><td colspan="3"> <hr></td></tr> <tr><th><a name="MELT-Concept-Index-1_cp_letter-G">G</a></th><td></td><td></td></tr> <tr><td></td><td valign="top"><a href="#index-get_005ffield-MELT-syntax"><code>get_field</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td colspan="3"> <hr></td></tr> <tr><th><a name="MELT-Concept-Index-1_cp_letter-I">I</a></th><td></td><td></td></tr> <tr><td></td><td valign="top"><a href="#index-if-MELT-syntax"><code>if</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-instance-MELT-syntax"><code>instance</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-integer-MELT-value">integer MELT value</a></td><td valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td></tr> <tr><td></td><td valign="top"><a href="#index-introduction">introduction</a></td><td valign="top"><a href="#Top">Introduction</a></td></tr> <tr><td></td><td valign="top"><a href="#index-Invoking-MELT">Invoking MELT</a></td><td valign="top"><a href="#Invoking-MELT">1.5 Invoking MELT</a></td></tr> <tr><td colspan="3"> <hr></td></tr> <tr><th><a name="MELT-Concept-Index-1_cp_letter-L">L</a></th><td></td><td></td></tr> <tr><td></td><td valign="top"><a href="#index-lambda-MELT-syntax"><code>lambda</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-let-MELT-syntax"><code>let</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-letrec-MELT-syntax"><code>letrec</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-list-MELT-syntax"><code>list</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-list-MELT-value">list MELT value</a></td><td valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td></tr> <tr><td colspan="3"> <hr></td></tr> <tr><th><a name="MELT-Concept-Index-1_cp_letter-M">M</a></th><td></td><td></td></tr> <tr><td></td><td valign="top"><a href="#index-macro-string-in-MELT">macro string in MELT</a></td><td valign="top"><a href="#Lexical-MELT-conventions">1.7.1 Lexical MELT conventions</a></td></tr> <tr><td></td><td valign="top"><a href="#index-macro_002dexpansion-in-MELT">macro-expansion in MELT</a></td><td valign="top"><a href="#MELT-translation-steps">1.7.3.4 MELT translation steps</a></td></tr> <tr><td></td><td valign="top"><a href="#index-match-MELT-syntax"><code>match</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-MELT">MELT</a></td><td valign="top"><a href="#MELT">1. MELT: Middle End Lisp Translator</a></td></tr> <tr><td></td><td valign="top"><a href="#index-MELT-as-a-plugin">MELT as a plugin</a></td><td valign="top"><a href="#MELT-as-a-plugin">1.4 MELT as a plugin</a></td></tr> <tr><td></td><td valign="top"><a href="#index-MELT-classes">MELT classes</a></td><td valign="top"><a href="#MELT-objects-and-classes">1.7.2.4 MELT objects and classes</a></td></tr> <tr><td></td><td valign="top"><a href="#index-MELT-objects">MELT objects</a></td><td valign="top"><a href="#MELT-objects-and-classes">1.7.2.4 MELT objects and classes</a></td></tr> <tr><td></td><td valign="top"><a href="#index-MELT-overview">MELT overview</a></td><td valign="top"><a href="#MELT-overview">1.2 MELT overview</a></td></tr> <tr><td></td><td valign="top"><a href="#index-Middle-End-Lisp-Translator">Middle End Lisp Translator</a></td><td valign="top"><a href="#MELT">1. MELT: Middle End Lisp Translator</a></td></tr> <tr><td></td><td valign="top"><a href="#index-minor-MELT-garbage-collection">minor MELT garbage collection</a></td><td valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td></tr> <tr><td></td><td valign="top"><a href="#index-mixints-MELT-value">mixints MELT value</a></td><td valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td></tr> <tr><td></td><td valign="top"><a href="#index-mixlocs-MELT-value">mixlocs MELT value</a></td><td valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td></tr> <tr><td></td><td valign="top"><a href="#index-modules-in-MELT">modules in MELT</a></td><td valign="top"><a href="#MELT-module-initialization-and-exports">1.7.3.3 MELT module initialization and exports</a></td></tr> <tr><td></td><td valign="top"><a href="#index-multicall-MELT-syntax"><code>multicall</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-multiple-MELT-value">multiple MELT value</a></td><td valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td></tr> <tr><td colspan="3"> <hr></td></tr> <tr><th><a name="MELT-Concept-Index-1_cp_letter-N">N</a></th><td></td><td></td></tr> <tr><td></td><td valign="top"><a href="#index-nil-MELT-value">nil MELT value</a></td><td valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td></tr> <tr><td></td><td valign="top"><a href="#index-normalization-in-MELT">normalization in MELT</a></td><td valign="top"><a href="#MELT-translation-steps">1.7.3.4 MELT translation steps</a></td></tr> <tr><td></td><td valign="top"><a href="#index-nrep-in-MELT">nrep in MELT</a></td><td valign="top"><a href="#MELT-translation-steps">1.7.3.4 MELT translation steps</a></td></tr> <tr><td colspan="3"> <hr></td></tr> <tr><th><a name="MELT-Concept-Index-1_cp_letter-O">O</a></th><td></td><td></td></tr> <tr><td></td><td valign="top"><a href="#index-objcode-in-MELT">objcode in MELT</a></td><td valign="top"><a href="#MELT-translation-steps">1.7.3.4 MELT translation steps</a></td></tr> <tr><td></td><td valign="top"><a href="#index-object-map-MELT-value">object map MELT value</a></td><td valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td></tr> <tr><td></td><td valign="top"><a href="#index-object-MELT-value">object MELT value</a></td><td valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td></tr> <tr><td></td><td valign="top"><a href="#index-object-MELT-values">object MELT values</a></td><td valign="top"><a href="#MELT-objects-and-classes">1.7.2.4 MELT objects and classes</a></td></tr> <tr><td></td><td valign="top"><a href="#index-or-MELT-syntax"><code>or</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td colspan="3"> <hr></td></tr> <tr><th><a name="MELT-Concept-Index-1_cp_letter-P">P</a></th><td></td><td></td></tr> <tr><td></td><td valign="top"><a href="#index-pair-MELT-value">pair MELT value</a></td><td valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td></tr> <tr><td></td><td valign="top"><a href="#index-parent_005fmodule_005fenvironment-MELT-syntax"><code>parent_module_environment</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-Primitive-in-MELT">Primitive in MELT</a></td><td valign="top"><a href="#Primitives-in-MELT">1.6.2 Primitives in MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-progn-MELT-syntax"><code>progn</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-put_005ffields-MELT-syntax_002e"><code>put_fields</code> MELT syntax.</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td colspan="3"> <hr></td></tr> <tr><th><a name="MELT-Concept-Index-1_cp_letter-Q">Q</a></th><td></td><td></td></tr> <tr><td></td><td valign="top"><a href="#index-quote-MELT-syntax"><code>quote</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td colspan="3"> <hr></td></tr> <tr><th><a name="MELT-Concept-Index-1_cp_letter-R">R</a></th><td></td><td></td></tr> <tr><td></td><td valign="top"><a href="#index-reader-in-MELT">reader in MELT</a></td><td valign="top"><a href="#MELT-translation-steps">1.7.3.4 MELT translation steps</a></td></tr> <tr><td></td><td valign="top"><a href="#index-Reference-on-MELT">Reference on MELT</a></td><td valign="top"><a href="#Reference-on-MELT">1.7 Reference on MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-return-MELT-syntax"><code>return</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-routine-MELT-value">routine MELT value</a></td><td valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td></tr> <tr><td colspan="3"> <hr></td></tr> <tr><th><a name="MELT-Concept-Index-1_cp_letter-S">S</a></th><td></td><td></td></tr> <tr><td></td><td valign="top"><a href="#index-s_002dexpression-in-MELT">s-expression in MELT</a></td><td valign="top"><a href="#MELT-translation-steps">1.7.3.4 MELT translation steps</a></td></tr> <tr><td></td><td valign="top"><a href="#index-setq-MELT-syntax"><code>setq</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-special-MELT-values">special MELT values</a></td><td valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td></tr> <tr><td></td><td valign="top"><a href="#index-store_005fpredefined-MELT-syntax"><code>store_predefined</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-string-map-MELT-value">string map MELT value</a></td><td valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td></tr> <tr><td></td><td valign="top"><a href="#index-string-MELT-value">string MELT value</a></td><td valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td></tr> <tr><td></td><td valign="top"><a href="#index-string_002dbuffer-MELT-value">string-buffer MELT value</a></td><td valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td></tr> <tr><td colspan="3"> <hr></td></tr> <tr><th><a name="MELT-Concept-Index-1_cp_letter-T">T</a></th><td></td><td></td></tr> <tr><td></td><td valign="top"><a href="#index-translation-of-MELT">translation of MELT</a></td><td valign="top"><a href="#translating-a-MELT-module">1.7.3.2 translating a MELT module</a></td></tr> <tr><td></td><td valign="top"><a href="#index-triple-MELT-value">triple MELT value</a></td><td valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td></tr> <tr><td></td><td valign="top"><a href="#index-tuple-MELT-syntax"><code>tuple</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-Tutorial-about-MELT">Tutorial about MELT</a></td><td valign="top"><a href="#Tutorial-about-MELT">1.6 Tutorial about MELT</a></td></tr> <tr><td colspan="3"> <hr></td></tr> <tr><th><a name="MELT-Concept-Index-1_cp_letter-U">U</a></th><td></td><td></td></tr> <tr><td></td><td valign="top"><a href="#index-unboxed-MELT-stuff">unboxed MELT stuff</a></td><td valign="top"><a href="#Primitives-in-MELT">1.6.2 Primitives in MELT</a></td></tr> <tr><td></td><td valign="top"><a href="#index-unsafe_005fget_005ffield-MELT-syntax"><code>unsafe_get_field</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-unsafe_005fput_005ffields-MELT-syntax"><code>unsafe_put_fields</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-update_005fcurrent_005fmodule_005fenvironment_005fcontainer-MELT-syntax"><code>update_current_module_environment_container</code> MELT syntax</a></td><td valign="top"><a href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-upgrade_002dwarmelt-make-target-for-MELT"><code>upgrade-warmelt</code> make target for MELT</a></td><td valign="top"><a href="#Tutorial-about-MELT">1.6 Tutorial about MELT</a></td></tr> <tr><td colspan="3"> <hr></td></tr> <tr><th><a name="MELT-Concept-Index-1_cp_letter-V">V</a></th><td></td><td></td></tr> <tr><td></td><td valign="top"><a href="#index-values-in-MELT">values in MELT</a></td><td valign="top"><a href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></td></tr> <tr><td colspan="3"> <hr></td></tr> </table> <table><tr><th valign="top">Jump to: </th><td><a href="#MELT-Concept-Index-1_cp_letter-A" class="summary-letter"><b>A</b></a> <a href="#MELT-Concept-Index-1_cp_letter-B" class="summary-letter"><b>B</b></a> <a href="#MELT-Concept-Index-1_cp_letter-C" class="summary-letter"><b>C</b></a> <a href="#MELT-Concept-Index-1_cp_letter-D" class="summary-letter"><b>D</b></a> <a href="#MELT-Concept-Index-1_cp_letter-E" class="summary-letter"><b>E</b></a> <a href="#MELT-Concept-Index-1_cp_letter-F" class="summary-letter"><b>F</b></a> <a href="#MELT-Concept-Index-1_cp_letter-G" class="summary-letter"><b>G</b></a> <a href="#MELT-Concept-Index-1_cp_letter-I" class="summary-letter"><b>I</b></a> <a href="#MELT-Concept-Index-1_cp_letter-L" class="summary-letter"><b>L</b></a> <a href="#MELT-Concept-Index-1_cp_letter-M" class="summary-letter"><b>M</b></a> <a href="#MELT-Concept-Index-1_cp_letter-N" class="summary-letter"><b>N</b></a> <a href="#MELT-Concept-Index-1_cp_letter-O" class="summary-letter"><b>O</b></a> <a href="#MELT-Concept-Index-1_cp_letter-P" class="summary-letter"><b>P</b></a> <a href="#MELT-Concept-Index-1_cp_letter-Q" class="summary-letter"><b>Q</b></a> <a href="#MELT-Concept-Index-1_cp_letter-R" class="summary-letter"><b>R</b></a> <a href="#MELT-Concept-Index-1_cp_letter-S" class="summary-letter"><b>S</b></a> <a href="#MELT-Concept-Index-1_cp_letter-T" class="summary-letter"><b>T</b></a> <a href="#MELT-Concept-Index-1_cp_letter-U" class="summary-letter"><b>U</b></a> <a href="#MELT-Concept-Index-1_cp_letter-V" class="summary-letter"><b>V</b></a> </td></tr></table> <hr size="6"> <a name="SEC_Foot"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <h1>Footnotes</h1> <h3><a name="FOOT1" href="#DOCF1">(1)</a></h3> <p><code>curfnum</code> is a C macro expanding to <code>curframe__.varnum</code> </p><h3><a name="FOOT2" href="#DOCF2">(2)</a></h3> <p>The C code for the normalization of <var>a</var> which assigns <code>curfnum[3]</code> occurs before, so translating MELT to C is not a simple rewriting algorithm.. </p><h3><a name="FOOT3" href="#DOCF3">(3)</a></h3> <p>The <code>#line</code> directive can be disabled by compiling the generated C with <code>-DMELTGCC_NOLINENUMBERING</code>. </p><h3><a name="FOOT4" href="#DOCF4">(4)</a></h3> <p><code>melt_apply</code> is a short inlined function defined in ‘<tt>gcc/melt.h</tt>’ which checks that the applied value is indeed a MELT function closure and calls its routine. </p><h3><a name="FOOT5" href="#DOCF5">(5)</a></h3> <p>There is an ordered sequence of MELT modules, the very first, <code>warmelt-first</code>, being translated specially and gets a nil parent. </p><h3><a name="FOOT6" href="#DOCF6">(6)</a></h3> <p>If a class is exported using <code>export_value</code> -almost always a mistake-, its fields are not visible outside. </p><h3><a name="FOOT7" href="#DOCF7">(7)</a></h3> <p>We use ML like syntax to emphasize that this is only an internal MELT representation, not an s-expr! </p><h3><a name="FOOT8" href="#DOCF8">(8)</a></h3> <p>this is not a proper term, since the generated code is only a representation of low level C code. </p><h3><a name="FOOT9" href="#DOCF9">(9)</a></h3> <p>using the <code>upgrade-warmelt</code> make target. </p><h3><a name="FOOT10" href="#DOCF10">(10)</a></h3> <p>It is essential to ensure that every MELT value has the good magic numer in its discriminant. Violating that would crash GCC MELT. </p><hr size="1"> <a name="SEC_Contents"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <h1>Table of Contents</h1> <div class="contents"> <ul class="toc"> <li><a name="toc-MELT_003a-Middle-End-Lisp-Translator" href="#MELT">1. MELT: Middle End Lisp Translator</a> <ul class="toc"> <li><a name="toc-MELT-Prerequisites-1" href="#MELT-Prerequisites">1.1 MELT Prerequisites</a></li> <li><a name="toc-MELT-overview-1" href="#MELT-overview">1.2 MELT overview</a></li> <li><a name="toc-Building-the-MELT-branch-1" href="#Building-the-MELT-branch">1.3 Building the MELT branch</a></li> <li><a name="toc-MELT-as-a-plugin-1" href="#MELT-as-a-plugin">1.4 MELT as a plugin</a></li> <li><a name="toc-Invoking-MELT-1" href="#Invoking-MELT">1.5 Invoking MELT</a></li> <li><a name="toc-Tutorial-about-MELT-1" href="#Tutorial-about-MELT">1.6 Tutorial about MELT</a> <ul class="toc"> <li><a name="toc-Reserved-MELT-syntax-and-symbols-1" href="#Reserved-MELT-syntax-and-symbols">1.6.1 Reserved MELT syntax and symbols</a></li> <li><a name="toc-Primitives-in-MELT-1" href="#Primitives-in-MELT">1.6.2 Primitives in MELT</a></li> <li><a name="toc-Citerators-in-MELT-1" href="#Citerators-in-MELT">1.6.3 Citerators in MELT</a></li> <li><a name="toc-Functions-in-MELT-1" href="#Functions-in-MELT">1.6.4 Functions in MELT</a></li> </ul></li> <li><a name="toc-Reference-on-MELT-1" href="#Reference-on-MELT">1.7 Reference on MELT</a> <ul class="toc"> <li><a name="toc-Lexical-MELT-conventions-1" href="#Lexical-MELT-conventions">1.7.1 Lexical MELT conventions</a></li> <li><a name="toc-Main-MELT-syntax-and-features-1" href="#Main-MELT-syntax-and-features">1.7.2 Main MELT syntax and features</a> <ul class="toc"> <li><a name="toc-MELT-formals-1" href="#MELT-formals">1.7.2.1 MELT formals</a></li> <li><a name="toc-MELT-ctypes-1" href="#MELT-ctypes">1.7.2.2 MELT ctypes</a></li> <li><a name="toc-MELT-boxed-values-1" href="#MELT-boxed-values">1.7.2.3 MELT boxed values</a></li> <li><a name="toc-MELT-objects-and-classes-1" href="#MELT-objects-and-classes">1.7.2.4 MELT objects and classes</a></li> <li><a name="toc-MELT-function-application-1" href="#MELT-function-application">1.7.2.5 MELT function application</a></li> <li><a name="toc-MELT-function-abstraction-and-closures-1" href="#MELT-function-abstraction-and-closures">1.7.2.6 MELT function abstraction and closures</a></li> <li><a name="toc-MELT-message-sending-1" href="#MELT-message-sending">1.7.2.7 MELT message sending</a></li> <li><a name="toc-MELT-syntax-constructs-1" href="#MELT-syntax-constructs">1.7.2.8 MELT syntax constructs</a></li> </ul></li> <li><a name="toc-MELT-modules-and-translation-1" href="#MELT-modules-and-translation">1.7.3 MELT modules and translation</a> <ul class="toc"> <li><a name="toc-MELT-environments-and-bindings-1" href="#MELT-environments-and-bindings">1.7.3.1 MELT environments and bindings</a></li> <li><a name="toc-translating-a-MELT-module-1" href="#translating-a-MELT-module">1.7.3.2 translating a MELT module</a></li> <li><a name="toc-MELT-module-initialization-and-exports-1" href="#MELT-module-initialization-and-exports">1.7.3.3 MELT module initialization and exports</a></li> <li><a name="toc-MELT-translation-steps-1" href="#MELT-translation-steps">1.7.3.4 MELT translation steps</a></li> </ul></li> <li><a name="toc-Writing-GCC-passes-in-MELT-1" href="#Writing-GCC-passes-in-MELT">1.7.4 Writing GCC passes in MELT</a></li> </ul></li> <li><a name="toc-Writing-C-code-for-MELT-1" href="#Writing-C-code-for-MELT">1.8 Writing C code for MELT</a></li> </ul></li> <li><a name="toc-Funding-Free-Software" href="#Funding">Funding Free Software</a></li> <li><a name="toc-The-GNU-Project-and-GNU_002fLinux" href="#GNU-Project">The GNU Project and GNU/Linux</a></li> <li><a name="toc-GNU-General-Public-License" href="#Copying">GNU General Public License</a></li> <li><a name="toc-GNU-Free-Documentation-License-1" href="#GNU-Free-Documentation-License">GNU Free Documentation License</a> <ul class="toc"> <li><a name="toc-ADDENDUM_003a-How-to-use-this-License-for-your-documents" href="#ADDENDUM_003a-How-to-use-this-License-for-your-documents">ADDENDUM: How to use this License for your documents</a></li> </ul></li> <li><a name="toc-MELT-Option-Index-1" href="#MELT-Option-Index">MELT Option Index</a></li> <li><a name="toc-MELT-Concept-Index-1" href="#MELT-Concept-Index">MELT Concept Index</a></li> </ul> </div> <hr size="1"> <a name="SEC_Overview"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <h1>Short Table of Contents</h1> <div class="shortcontents"> <ul class="toc"> <li><a name="stoc-MELT_003a-Middle-End-Lisp-Translator" href="#MELT">1. MELT: Middle End Lisp Translator</a></li> <li><a name="stoc-Funding-Free-Software" href="#Funding">Funding Free Software</a></li> <li><a name="stoc-The-GNU-Project-and-GNU_002fLinux" href="#GNU-Project">The GNU Project and GNU/Linux</a></li> <li><a name="stoc-GNU-General-Public-License" href="#Copying">GNU General Public License</a></li> <li><a name="stoc-GNU-Free-Documentation-License-1" href="#GNU-Free-Documentation-License">GNU Free Documentation License</a></li> <li><a name="stoc-MELT-Option-Index-1" href="#MELT-Option-Index">MELT Option Index</a></li> <li><a name="stoc-MELT-Concept-Index-1" href="#MELT-Concept-Index">MELT Concept Index</a></li> </ul> </div> <hr size="1"> <a name="SEC_About"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="#MELT-Option-Index" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <h1>About This Document</h1> <p> This document was generated on <i>September 27, 2011</i> using <a href="http://www.nongnu.org/texi2html/"><i>texi2html 1.82</i></a>. </p> <p> The buttons in the navigation panels have the following meaning: </p> <table border="1"> <tr> <th> Button </th> <th> Name </th> <th> Go to </th> <th> From 1.2.3 go to</th> </tr> <tr> <td align="center"> [ < ] </td> <td align="center">Back</td> <td>Previous section in reading order</td> <td>1.2.2</td> </tr> <tr> <td align="center"> [ > ] </td> <td align="center">Forward</td> <td>Next section in reading order</td> <td>1.2.4</td> </tr> <tr> <td align="center"> [ << ] </td> <td align="center">FastBack</td> <td>Beginning of this chapter or previous chapter</td> <td>1</td> </tr> <tr> <td align="center"> [ Up ] </td> <td align="center">Up</td> <td>Up section</td> <td>1.2</td> </tr> <tr> <td align="center"> [ >> ] </td> <td align="center">FastForward</td> <td>Next chapter</td> <td>2</td> </tr> <tr> <td align="center"> [Top] </td> <td align="center">Top</td> <td>Cover (top) of document</td> <td> </td> </tr> <tr> <td align="center"> [Contents] </td> <td align="center">Contents</td> <td>Table of contents</td> <td> </td> </tr> <tr> <td align="center"> [Index] </td> <td align="center">Index</td> <td>Index</td> <td> </td> </tr> <tr> <td align="center"> [ ? ] </td> <td align="center">About</td> <td>About (help)</td> <td> </td> </tr> </table> <p> where the <strong> Example </strong> assumes that the current position is at <strong> Subsubsection One-Two-Three </strong> of a document of the following structure: </p> <ul> <li> 1. Section One <ul> <li>1.1 Subsection One-One <ul> <li>...</li> </ul> </li> <li>1.2 Subsection One-Two <ul> <li>1.2.1 Subsubsection One-Two-One</li> <li>1.2.2 Subsubsection One-Two-Two</li> <li>1.2.3 Subsubsection One-Two-Three <strong><== Current Position </strong></li> <li>1.2.4 Subsubsection One-Two-Four</li> </ul> </li> <li>1.3 Subsection One-Three <ul> <li>...</li> </ul> </li> <li>1.4 Subsection One-Four</li> </ul> </li> </ul> <hr size="1"> <p> <font size="-1"> This document was generated on <i>September 27, 2011</i> using <a href="http://www.nongnu.org/texi2html/"><i>texi2html 1.82</i></a>. </font> <br> </p> </body> </html>