Permalink
Browse files

More of section 2

  • Loading branch information...
1 parent 0d3f432 commit 8746e8509a026849926168bba4d498fcb2fd1972 Edwin Brady committed Jan 15, 2011
Showing with 544 additions and 52 deletions.
  1. +1 −1 Atuin/atuin.cabal
  2. +4 −6 Epic/Epic.lhs
  3. +1 −1 FL/fl.cabal
  4. +5 −27 Papers/Epic/example.tex
  5. +1 −1 Papers/Epic/intro.tex
  6. +532 −16 Papers/Epic/language.tex
View
@@ -1,5 +1,5 @@
Name: atuin
-Version: 0.1.1
+Version: 0.1.2
Author: Edwin Brady
License: BSD3
License-file: LICENSE
View
@@ -64,18 +64,16 @@ Allow Haskell functions to be used to build expressions.
> instance EpicExpr Term where
> term e = e
-> instance (EpicExpr e) => EpicExpr (Expr -> e) where
+> instance EpicExpr e => EpicExpr (Expr -> e) where
> term f = do var <- get
> put (var+1)
> let arg = MN "evar" var
> e' <- term (f (R arg))
> return (Lam arg TyAny e')
-> instance EpicExpr ([Name], Expr) where
-> term (ns, e) = lam ns e where
-> lam [] e = return e
-> lam (n:ns) e = do e' <- lam ns e
-> return (Lam n TyAny e')
+> instance EpicExpr e => EpicExpr ([Name], e) where
+> term (ns, e) = do e' <- term e
+> foldM (\e n -> return (Lam n TyAny e)) e' ns
> -- | Build a function definition, with a name supply
> class EpicFn e where
View
@@ -1,5 +1,5 @@
Name: fl
-Version: 0.1.1
+Version: 0.1.2
Author: Edwin Brady
License: BSD3
License-file: LICENSE
View
@@ -78,46 +78,25 @@ \subsubsection{Compilation}
Our aim is to convert a collection of \texttt{Defs} into an
executable, using one of the following functions from the Epic API:
-\begin{SaveVerbatim}{compepic}
-
-compile :: Program -> FilePath -> IO ()
-run :: Program -> IO ()
-
-\end{SaveVerbatim}
\useverb{compepic}
\noindent
Given an Epic \texttt{Program}, \texttt{compile} will generate an
executable, and \texttt{run} will generate an executable then run it.
-A program is a collection of named Epic declarations:
+Recall that a program is a collection of named Epic declarations:
\begin{SaveVerbatim}{eprogs}
-data EpicDecl = forall e. EpicFn e => EpicFn Name e
+data EpicDecl = forall e. EpicExpr e => EpicFn Name e
| ...
type Program = [EpicDecl]
\end{SaveVerbatim}
\useverb{eprogs}
-\noindent
-Epic declarations are usually just an Epic function (\texttt{EpicFn})
-but can also be used to include C header files, declare libraries for
-linking and declare types for exporting as C types. The library also
-provides a number of built in definitions for some common operations
-such as outputting strings and converting data types:
-
-\begin{SaveVerbatim}{bdefs}
-
-basic_defs :: [EpicDecl]
-
-\end{SaveVerbatim}
-\useverb{bdefs}
-
-\noindent
Our goal, then, is to convert a \texttt{Lang} definition into
-something which is an instance of \texttt{EpicFn}. We use
+something which is an instance of \texttt{EpicExpr}. We use
\texttt{Term}, which is an Epic expression which carries a name
supply. Most of the term construction functions in the Epic API return
a \texttt{Term}.
@@ -200,9 +179,8 @@ \subsubsection{Compilation}
\noindent
Given \texttt{build}, we can translate a collection of HOAS
definitions into an Epic program, add the built-in Epic definitions
-and execute it directly. Execution begins with the function called
-\texttt{"main"} --- Epic reports an error if this function is not
-defined.
+and execute it directly. Recall that there must be a function called
+\texttt{"main"} or Epic will report an error.
\begin{SaveVerbatim}{lmain}
View
@@ -19,7 +19,7 @@ \section{Introduction}
short for ``\textbf{Epi}gram \textbf{C}ompiler''). Now used by
Idris~\cite{idris-plpv}, also as an experimental back end for Agda.
It is specifically designed for reuse by other languages (in constrast
-to, say, Haskell Core).
+to, say, GHC Core).
\subsection{Features and non-features}
Oops, something went wrong.

0 comments on commit 8746e85

Please sign in to comment.