implemented the program
This commit is contained in:
commit
807ea6f130
16 changed files with 517 additions and 0 deletions
18
app/Main.hs
Normal file
18
app/Main.hs
Normal file
|
@ -0,0 +1,18 @@
|
|||
module Main (main) where
|
||||
|
||||
import Lib
|
||||
import Control.Monad (mapM_)
|
||||
import Data.Binary (Word32, Word8, encode)
|
||||
import Data.Bits
|
||||
import qualified Data.ByteString.Lazy as BL
|
||||
|
||||
convertWord32 :: Word32 -> [Word8]
|
||||
convertWord32 w = [fromIntegral (w), fromIntegral (w .>>. 8), fromIntegral (w .>>. 16), fromIntegral (w .>>. 24)]
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
s <- getContents
|
||||
let tokens = tokenize s
|
||||
case parseTokens tokens of
|
||||
Left err -> putStr err
|
||||
Right ops -> mapM_ (BL.putStr . encode) . (concatMap (convertWord32)) $ (compile ops)
|
Loading…
Add table
Add a link
Reference in a new issue