2024-12-18 18:55:51 -06:00
|
|
|
module Main where
|
|
|
|
|
|
|
|
import Eval
|
|
|
|
import Lexer
|
|
|
|
import Parser
|
2024-12-20 11:38:09 -06:00
|
|
|
import REPL (repl)
|
2024-12-18 18:55:51 -06:00
|
|
|
import Research
|
|
|
|
|
2024-12-27 08:17:06 -06:00
|
|
|
import qualified Data.Map as Map
|
2024-12-18 18:55:51 -06:00
|
|
|
import Text.Megaparsec (runParser)
|
|
|
|
|
|
|
|
main :: IO ()
|
2024-12-27 14:10:13 -06:00
|
|
|
main = repl library
|
2024-12-27 12:27:00 -06:00
|
|
|
|
|
|
|
runSapling :: String -> String
|
|
|
|
runSapling s = show $ result (evalSapling Map.empty $ parseSapling s)
|
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)"
|
|
|
|
|
|
|
|
runSaplingEnv env s = show $ result (evalSapling env $ parseSapling s)
|