Permalink
Browse files

Added start of OTTLang definition, and a README

darcs-hash:20070504202219-974a0-20f90b7e5d11a369c861fde8e60f95e313296a32.gz
  • Loading branch information...
1 parent 1e324a7 commit e2413467fc35a24e19c6995f02bb3785dcbea8c3 eb committed May 4, 2007
Showing with 41 additions and 6 deletions.
  1. +0 −1 Epic/Bytecode.lhs
  2. +4 −2 Epic/Language.lhs
  3. +18 −1 Epic/OTTLang.lhs
  4. +1 −1 Makefile
  5. +17 −0 README
  6. +1 −1 epic.cabal
View
@@ -6,7 +6,6 @@
> import Epic.Language
> type Local = Int
-> type Tag = Int
> type TmpVar = Int
Register based - most operations do an action, then put the result in a
View
@@ -59,11 +59,13 @@ Get the arity of a definition in the context
> Nothing -> error $ "No such function " ++ show x
> (Just (args,ret)) -> length args
+> type Tag = Int
+
> data Expr = V Int -- Locally bound name
> | R Name -- Global reference
> | App Expr [Expr] -- Function application
> | LazyApp Expr [Expr] -- Lazy function application
-> | Con Int [Expr] -- Constructor, tags, arguments (fully applied)
+> | Con Tag [Expr] -- Constructor, tags, arguments (fully applied)
> | Const Const -- a constant
> | Proj Expr Int -- Project argument
> | Case Expr [CaseAlt]
@@ -75,7 +77,7 @@ Get the arity of a definition in the context
> | ForeignCall Type String [(Expr, Type)] -- Foreign function call
> deriving (Show, Eq)
-> data CaseAlt = Alt { alt_tag :: Int,
+> data CaseAlt = Alt { alt_tag :: Tag,
> alt_args :: [(Name, Type)], -- bound arguments
> alt_expr :: Expr -- what to do
> }
View
@@ -1,3 +1,20 @@
> module Epic.OTTLang where
->
+> import Epic.Language
+
+Terms
+
+t = x | lam x. t | t t
+ | i t | hd(t) | tl(t) |
+ | switch(t) [t]
+ | TY
+
+> data OTTerm = OTRef Name -- Global or unresolved name
+> | OTV Int -- Locally bound name
+> | OTLam Name
+> | OTApp OTTerm OTTerm
+> | OTRec Tag OTTerm
+> | OTHd OTTerm
+> | OTTl OTTerm
+> | OTSwitch OTTerm [OTTerm]
+> | OTTY -- can't look at types, so dump them all here
View
@@ -31,7 +31,7 @@ clean:
test:
make -C tests
-epic: .PHONY package install
+epic: .PHONY configure package install
cd compiler; ghc $(GHCOPTS) --make Main.lhs -o epic -package epic
epic_install: epic
View
17 README
@@ -0,0 +1,17 @@
+
+Build instructions:
+
+ * Edit the Makefile to set an appopriate prefix;
+ the default is to install in ~/bin and ~/lib.
+ * make configure
+ * make install, to install just the API, or make epic_install to
+ install the command line compiler, 'epic'.
+
+The command line tool, epic takes a source file and produces executable
+code, via C. Separate compilation is supported, in a fairly simple
+way, e.g. to compile a main program main.e which includes some
+functions defined in lib.e:
+
+ * Build lib.o with the command epic -c lib.e.
+ * Import functions in main.e with the line include "lib.ei" in the source.
+ * Build the executable with epic main.e lib.o -o main
View
@@ -1,5 +1,5 @@
Name: epic
-Version: 0.1
+Version: 0.1.1
Author: Edwin Brady
License: BSD3
License-file: LICENSE

0 comments on commit e241346

Please sign in to comment.