module Lib
( microcCompilerLine
, microcCompilerStr
, microcCompiler
) where
import System.IO
import Control.Monad
import ParseMicroc
import Text.ParserCombinators.Parsec
microcCompilerLine :: String -> String
microcCompilerLine "" = ""
microcCompilerLine str = either show id $ parse input "microc(c->asm)" str
microcCompilerStr :: String -> String
microcCompilerStr str = unlines $ map microcCompilerLine $ lines str
microcCompiler::IO()
microcCompiler = do
s <- getLine
eof <- isEOF
putStr $ microcCompilerLine s
unless eof microcCompiler