mirror of
https://github.com/Noratrieb/brainfuck.git
synced 2026-01-14 13:35:00 +01:00
nothing working for now
This commit is contained in:
parent
bd2d2ba8c5
commit
219f419bae
3 changed files with 27 additions and 6 deletions
|
|
@ -3,4 +3,4 @@ module Main where
|
|||
import Lib
|
||||
|
||||
main :: IO ()
|
||||
main = someFunc
|
||||
main = main
|
||||
|
|
|
|||
|
|
@ -1,6 +1,29 @@
|
|||
module Lib
|
||||
( someFunc
|
||||
( main
|
||||
) where
|
||||
|
||||
someFunc :: IO ()
|
||||
someFunc = putStrLn "someFunc"
|
||||
import System.Environment
|
||||
import Data.List
|
||||
import System.IO
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
args <- getArgs
|
||||
program <- readFile $ head args
|
||||
interpret program
|
||||
|
||||
data Memory = Memory [Int] Int [Int]
|
||||
|
||||
interpret :: String -> IO ()
|
||||
interpret [] = IO()
|
||||
interpret [x:xs] = do
|
||||
eval x
|
||||
interpret xs
|
||||
|
||||
|
||||
eval :: String -> Memory -> IO Memory
|
||||
eval s (Memory sx x xs)
|
||||
| x == "+" = Memory sx (x + 1) xs
|
||||
| x == "-" = Memory sx (x - 1) xs
|
||||
otherwise = undefined
|
||||
eval _ = undefined
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
main :: IO ()
|
||||
main = putStrLn "Test suite not yet implemented"
|
||||
Loading…
Add table
Add a link
Reference in a new issue