File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import Text.RawString.QQ
1919import qualified Data.Bifunctor
2020import LambdaToSKI (compileBracket )
2121import TermReducer
22+ import IonAssembly (toIon )
2223
2324
2425printGraph :: ST s (STRef s (Graph s )) -> ST s String
@@ -74,7 +75,9 @@ fibonacci = [r|
7475
7576
7677printCS :: CL -> IO ()
77- printCS cl = putStrLn (" code size: " ++ show (codeSize cl))
78+ printCS cl = do
79+ putStrLn (" ION code: " ++ toIon cl)
80+ putStrLn (" code size: " ++ show (codeSize cl))
7881
7982-- data CL = Com Combinator | INT Integer | CL :@ CL
8083codeSize :: CL -> Int
@@ -114,9 +117,7 @@ showCompilations source = do
114117 print expr'
115118 printCS expr'
116119 putStrLn " "
117- -- putStr "reduced: "
118- -- x <- red expr'
119- -- print x
120+
120121
121122 let expr'' = compileBulk env
122123 putStrLn " The main expression compiled to SICKBY combinator expressions with bulk combinators:"
Original file line number Diff line number Diff line change 11cabal-version : 1.12
22
3- -- This file has been generated from package.yaml by hpack version 0.35.2 .
3+ -- This file has been generated from package.yaml by hpack version 0.37.0 .
44--
55-- see: https://github.com/sol/hpack
66
@@ -31,6 +31,7 @@ library
3131 CLTerm
3232 GraphReduction
3333 HhiReducer
34+ IonAssembly
3435 Kiselyov
3536 LambdaToSKI
3637 Parser
@@ -40,7 +41,8 @@ library
4041 hs-source-dirs :
4142 src
4243 build-depends :
43- base >= 4.7 && < 5
44+ MicroHs
45+ , base >= 4.7 && < 5
4446 , parsec
4547 , raw-strings-qq
4648 default-language : GHC2021
@@ -55,7 +57,8 @@ executable benchmark
5557 benchmark
5658 ghc-options : -threaded -rtsopts -with-rtsopts=-N
5759 build-depends :
58- base >= 4.7 && < 5
60+ MicroHs
61+ , base >= 4.7 && < 5
5962 , criterion
6063 , lambda-ski
6164 , parsec
@@ -70,7 +73,8 @@ executable lambda-ski-exe
7073 app
7174 ghc-options : -threaded -rtsopts -with-rtsopts=-N
7275 build-depends :
73- base >= 4.7 && < 5
76+ MicroHs
77+ , base >= 4.7 && < 5
7478 , lambda-ski
7579 , parsec
7680 , raw-strings-qq
@@ -90,7 +94,8 @@ test-suite lambda-ski-test
9094 test
9195 ghc-options : -threaded -rtsopts -with-rtsopts=-N
9296 build-depends :
93- QuickCheck
97+ MicroHs
98+ , QuickCheck
9499 , base >= 4.7 && < 5
95100 , hspec
96101 , lambda-ski
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ dependencies:
2727- base >= 4.7 && < 5
2828- parsec
2929- raw-strings-qq
30+ - MicroHs
3031
3132library :
3233 source-dirs : src
Original file line number Diff line number Diff line change 1+ module IonAssembly where
2+
3+ import CLTerm
4+
5+ {- -
6+ digit = '0' | ... | '9'
7+ num = digit [num]
8+ con = '#' CHAR | '(' num ')'
9+ idx = '@' CHAR | '[' num ']'
10+ comb = 'S' | 'K' | 'I' | ...
11+ term = comb | '`' term term | con | idx
12+ prog = term ';' [prog]
13+ --}
14+
15+
16+ toIon :: CL -> String
17+ toIon (Com c) = show c
18+ toIon (INT i) = " (" ++ show i ++ " )"
19+ toIon (t :@ u) = " `" ++ toIon t ++ toIon u
20+
21+ test :: CL
22+ test = Com B :@ Com S :@ (Com B :@ Com B )
Original file line number Diff line number Diff line change 1717#
1818# resolver: ./custom-snapshot.yaml
1919# resolver: https://example.com/snapshots/2018-01-01.yaml
20- resolver :
21- url : https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/21/12.yaml
20+ resolver : lts-23.26
21+ # url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/21/12.yaml
2222
2323# User packages to be built.
2424# Various formats can be used as shown in the example below.
@@ -35,7 +35,12 @@ packages:
3535# These entries can reference officially published versions as well as
3636# forks / in-progress versions pinned to a git hash. For example:
3737#
38- # extra-deps:
38+ extra-deps :
39+ # - MicroHs-0.10.5.0
40+ - git : https://github.com/thma/MicroHs
41+ commit : a0426a5bc5e8461bd7937dd2ae1db9dea98724c2
42+
43+
3944# - acme-missiles-0.3
4045# - git: https://github.com/commercialhaskell/stack.git
4146# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
You can’t perform that action at this time.
0 commit comments