Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
76 lines (69 sloc) 3.9 KB
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
<title>Erasm++ - meta_prelude</title>
<link rel="stylesheet" type="text/css" href="./css/default.css"></link>
<link rel="stylesheet" type="text/css" href="./css/syntax.css"></link>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-29123087-1']);
_gaq.push(['_setDomainName', 'erasmpp.org']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<div id="main">
<div id="sidebar">
<div id="header">
<h1>Erasm++ </h1>
</div>
<!-- <h2>Navigation</h2> -->
<a href="./">About</a>
<ul>
<li> <a href="./erasm.html">ERASM++</a> </li>
<li> <a href="./gendsm.html">GenericDsm</a> </li>
<li> <a href="./meta_prelude.html">MetaPrelude</a> </li>
</ul>
<a href="./download.html">Download/Install</a>
<a href="./manual/manual.html">Online Manual</a>
<a href="./privacy.html">Privacy Policy</a>
</div>
<div id="content">
<h1 id="metaprelude">MetaPrelude</h1>
<p>{sec:erasm++}</p>
<p>MetaPrelude is a C++ metaprogramming library that tries to realize <a href="http://www.haskell.org">Haskell</a>-like (but untyped) purely-functional, non-strict type-level programming environment. It is used as the backend of static type-level computation in ERASM++ and GenericDsm. I hope it could help implementing more complex EDSLs than the assembly language.</p>
<p>It is still far from complete and mostly undocumented, and here I only list some of the most important limitations. The interested reader is invited to review the code directly.</p>
<ul>
<li><p>It is an untyped calculus.</p></li>
<li><p>The implementation is based on a naive top-most left-most evaluator, and is very inefficient.</p></li>
<li><p>It doesn’t support lambdas (efficiently). This implies, among other things, that you can’t have Haskell-style monads syntactically.</p></li>
<li><p>Pattern matching is not supported. Instead, users have to use a custom multiway conditional called <code>ifn</code> like the following:</p>
<pre><code>ifn&lt; isX&lt;x&gt; , thenX ,
isY&lt;x&gt; , thenY ,
...
defaultCase &gt;
</code></pre>
<p>Note that this is a lazy conditional, and is semantically different from Haskell’s case expressions.</p></li>
<li><p>In order to support currying, lots of ugly preprocessor hacks are involved. Furthermore, functions with only up to a fixed number (3 at this moment) of parameters can be curried. Defining a new function without macros is practically impossible.</p></li>
<li><p>Most importantly, the complexity of the program is dependent upon the particular compiler implementation! Some versions of compilers cache template instantiations, some do not, others in-between at various degrees, and all this can make a difference of linear to super-exponential complexity.</p></li>
</ul>
<p>For the moment, code is the only documentation. Please see the following files in the distribution if you are interested:</p>
<ul>
<li><p><code>src/erasm/meta_prelude.hpp</code></p></li>
<li><p><code>src/erasm/meta_leftist_heap.hpp</code></p></li>
<li><p><code>src/erasm/meta_polynomial.hpp</code></p></li>
<li><p><code>src/erasm/x86_addr16.hpp</code></p></li>
<li><p><code>src/erasm/x86_addr32.hpp</code></p></li>
<li><p><code>src/erasm/x64_addr64.hpp</code></p></li>
</ul>
</div>
</dev>
</body>
</html>