tricu/src/Main.hs

31 lines
842 B
Haskell
Raw Normal View History

module Main where
import Eval
import Lexer
import Parser
import REPL (repl)
import Research
2024-12-27 08:17:06 -06:00
import qualified Data.Map as Map
import Text.Megaparsec (runParser)
main :: IO ()
2024-12-27 14:10:13 -06:00
main = repl library
runSapling :: String -> String
runSapling s = show $ result (evalSapling Map.empty $ parseSapling s)
2024-12-27 14:10:13 -06:00
library :: Map.Map String T
2024-12-27 14:10:13 -06:00
library = evalSapling Map.empty $ parseSapling
"false = t\n \
\ true = t t\n \
\ id = (\\a : a)\n \
\ triage = (\\a b c : t (t a b) c)\n \
\ match_bool = (\\ot of : triage of (\\z : ot) t)\n \
\ and = match_bool id (\\z : false)\n \
\ if = (\\cond then else : t (t else (t t then)) t cond)\n \
\ triage = (\\a b c : t (t a b) c)\n \
\ test = triage \"leaf\" (\\z : \"stem\") (\\a b : \"fork\")"
2024-12-27 14:10:13 -06:00
runSaplingEnv env s = show $ result (evalSapling env $ parseSapling s)