Skip to content

Commit

Permalink
+CrByte in collectV
Browse files Browse the repository at this point in the history
Ignore-this: 5d707bf538ea3efa3cb9418b69667b86

darcs-hash:20101115150941-09b00-3043a0276a36f3f80688d8d41c0cd52232307b4a
  • Loading branch information
xy-kasumi committed Nov 15, 2010
1 parent 2a1ff50 commit d3d545d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 182 deletions.
3 changes: 2 additions & 1 deletion Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ collectV (CrApp e0 e1)=collectV e0 `S.union` collectV e1
collectV (CrLet _ bs e)=S.unions $ map collectV $ e:map snd bs
collectV (CrCase e cs)=S.unions $ map collectV $ e:map thr3 cs
collectV (CrLm as e)=collectV e

collectV (CrByte _)=S.empty
collectV e=error $ "collectV: "++show e



Expand Down
6 changes: 3 additions & 3 deletions Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ data Option=Option

-- | Parse arguments to 'Command'. Note this is a total function.
parseArgs :: [String] -> Command
parseArgs []=ShowMessage version
parseArgs []=ShowMessage $ version++"\n"++help
parseArgs ("-v":_)=ShowMessage version
parseArgs ("--version":_)=ShowMessage version
parseArgs ("-h":_)=ShowMessage $ version++"\n"++help
Expand Down Expand Up @@ -102,7 +102,7 @@ execCommand (Compile opt from)=partialChain opt from $
where f g=runProcessWithIO (putStr . g)

partialChain opt from (c0,c1,g0,g1,s0,s1,b)=do
dir<-liftM takeDirectory $ Paths_hs2bf.getDataFileName "Prelude.hs"
dir<-Paths_hs2bf.getDataDir
let (mod,env)=analyzeName from dir
xs<-Front.collectModules env mod
let cr =xs >>= Front.compile
Expand Down Expand Up @@ -142,7 +142,7 @@ help=unlines $
," -Sgr: to GMachine (simplified)"
," -Ss : to SAM"
," -Ssf: to SAM (most simplified)"
," -Sr : to SCGR"
-- ," -Sr : to SCGR" -- not implemented
," -Sb : to BF"
," --addr n : use n byte for pointer arithmetic"
," --debug : include detailed error message (this will make the program a LOT larger)"
Expand Down
2 changes: 1 addition & 1 deletion SCGR.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- | Super-cool-graph-representation
-- | Super-cool-graph-representation (this module is not used now)
--
-- There are 3 goals in optimization:
--
Expand Down
8 changes: 5 additions & 3 deletions hs2bf.cabal
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
name: hs2bf
cabal-version: >=1.2
version: 0.5
version: 0.6
author: xanxys
maintainer: [email protected]
synopsis: Haskell to Brainfu*k compiler
license: BSD3
license-File: LICENSE
category: Compiler
description: Haskell to Brainfu*k compiler.
description:
Proof of concept implementation of Haskell to Brainfu*k compiler.
You can find examples of compilable codes at http://www.xanxys.net/public/hs2bf-demo/
build-type: Simple
data-files: Prelude.hs
data-dir: test
tested-with: GHC==6.10.4
tested-with: GHC==6.10.4,GHC==6.12.1
extra-source-files:
Front.hs Core.hs GMachine.hs SAM.hs SCGR.hs Brainfuck.hs
Util.hs SRuntime.hs
Expand Down
174 changes: 0 additions & 174 deletions test/Prelude.hs

This file was deleted.

0 comments on commit d3d545d

Please sign in to comment.