BASIC-0.1.0.0: Language/BASIC.hs
-- |A simplified embedded version of original BASIC.
-- Some things work, some things just give utterly mysterious type errors.
--
-- Beware, this is just a fun weekend hack.
module Language.BASIC(module Language.BASIC.Parser, module Language.BASIC.Types, runBASIC, runBASIC') where
import System.TimeIt
import Language.BASIC.Parser hiding (Expr)
import Language.BASIC.Types(Expr(I, S, X, Y, Z, RND, INT, SGN))
import Language.BASIC.Interp
import Language.BASIC.Translate
-- |Run a BASIC program with an interpreter.
runBASIC :: BASIC -> IO ()
runBASIC x = do
let cmds = getBASIC x
-- putStrLn $ unlines $ map show cmds
timeIt $ executeBASIC cmds
-- |Run a BASIC program with a compiler.
runBASIC' :: BASIC -> IO ()
runBASIC' x = do
let cmds = getBASIC x
-- putStrLn $ unlines $ map show cmds
-- executeBASIC cmds
func <- translateBASIC cmds
timeIt func