MAJOR MIlESTONE: FACTORIAL PROGRAM FROM SRC TO EXECUTION
This commit is contained in:
86
src/TIM.hs
86
src/TIM.hs
@@ -422,92 +422,6 @@ hdbgProg p hio = do
|
||||
TiState [resAddr] _ h _ sts = last p'
|
||||
res = hLookupUnsafe resAddr h
|
||||
|
||||
-- letrecExample :: Program
|
||||
-- letrecExample = Program
|
||||
-- [ ScDef "pair" ["x","y","f"] $ "f" :$ "x" :$ "y"
|
||||
-- , ScDef "fst" ["p"] $ "p" :$ "K"
|
||||
-- , ScDef "snd" ["p"] $ "p" :$ "K1"
|
||||
-- , ScDef "f" ["x","y"] $
|
||||
-- Let Rec
|
||||
-- [ "a" := "pair" :$ "x" :$ "b"
|
||||
-- , "b" := "pair" :$ "y" :$ "a"
|
||||
-- ]
|
||||
-- ("fst" :$ ("snd" :$ ("snd" :$ ("snd" :$ "a"))))
|
||||
-- , ScDef "main" [] $ "f" :$ IntE 3 :$ IntE 4
|
||||
-- ]
|
||||
|
||||
-- idExample :: Program
|
||||
-- idExample = Program
|
||||
-- [ ScDef "main" [] $ "id" :$ IntE 3
|
||||
-- ]
|
||||
|
||||
-- indExample1 :: Program
|
||||
-- indExample1 = Program
|
||||
-- [ ScDef "main" [] $ "twice" :$ "twice" :$ "id" :$ IntE 3
|
||||
-- ]
|
||||
|
||||
-- indExample2 :: Program
|
||||
-- indExample2 = Program
|
||||
-- [ ScDef "main" [] $ "twice" :$ "twice" :$ "twice" :$ "id" :$ IntE 3
|
||||
-- ]
|
||||
|
||||
-- indExample3 :: Program
|
||||
-- indExample3 = Program
|
||||
-- [ ScDef "main" [] $
|
||||
-- Let Rec
|
||||
-- [ "x" := IntE 2
|
||||
-- , "y" := "f" :$ "x" :$ "x"
|
||||
-- ]
|
||||
-- ("g" :$ "y" :$ "y")
|
||||
-- , ScDef "f" ["a","b"] $ "b"
|
||||
-- , ScDef "g" ["a","b"] $ "a"
|
||||
-- ]
|
||||
|
||||
-- negExample1 :: Program
|
||||
-- negExample1 = Program
|
||||
-- [ ScDef "main" [] $
|
||||
-- "negate#" :$ ("id" :$ IntE 3)
|
||||
-- ]
|
||||
|
||||
-- negExample2 :: Program
|
||||
-- negExample2 = Program
|
||||
-- [ ScDef "main" [] $
|
||||
-- "negate#" :$ IntE 3
|
||||
-- ]
|
||||
|
||||
-- negExample3 :: Program
|
||||
-- negExample3 = Program
|
||||
-- [ ScDef "main" [] $
|
||||
-- "twice" :$ "negate#" :$ IntE 3
|
||||
-- ]
|
||||
|
||||
-- arithExample1 :: Program
|
||||
-- arithExample1 = Program
|
||||
-- [ ScDef "main" [] $
|
||||
-- "+#" :$ (IntE 3) :$ ("negate#" :$ (IntE 2))
|
||||
-- ]
|
||||
|
||||
-- arithExample2 :: Program
|
||||
-- arithExample2 = Program
|
||||
-- [ ScDef "main" [] $
|
||||
-- "negate#" :$ ("+#" :$ (IntE 2) :$ ("*#" :$ IntE 5 :$ IntE 3))
|
||||
-- ]
|
||||
|
||||
-- ifExample :: Program
|
||||
-- ifExample = Program
|
||||
-- [ ScDef "main" [] $
|
||||
-- "if#" :$ "True" :$ IntE 2 :$ IntE 3
|
||||
-- ]
|
||||
|
||||
-- facExample :: Program
|
||||
-- facExample = Program
|
||||
-- [ ScDef "fac" ["n"] $
|
||||
-- "if#" :$ ("==#" :$ "n" :$ IntE 0)
|
||||
-- :$ (IntE 1)
|
||||
-- :$ ("*#" :$ "n" :$ ("fac" :$ ("-#" :$ "n" :$ IntE 1)))
|
||||
-- , ScDef "main" [] $ "fac" :$ IntE 3
|
||||
-- ]
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
|
||||
instance Pretty TiState where
|
||||
|
||||
Reference in New Issue
Block a user