Haskell Hastles
Posted: Tue Sep 18, 2007 5:22 pm
I've been working on a brainf*ck interpreter to expand my knowledge of Haskell, and functional programming in general. However, as simple as it seems, I've been having some troubles.
At the moment, I'm working on everything but the '[' and ']' commands. Here is what I have so far (It only does one command per execution at the moment.):
It doesn't compile, but I think I'm on the right path.
Any help would be great. Thanks.
At the moment, I'm working on everything but the '[' and ']' commands. Here is what I have so far (It only does one command per execution at the moment.):
Code: Select all
module Main
where
import IO
bf (x:xs) '>' = (xs : 0)
bf (x:xs) '<' = [x]
bf (x:xs) '+' = [xs + 1]
bf (x:xs) '-' = [xs - 1]
array = [1..30000]
main = do
sym <- getChar
bf array sym
Any help would be great. Thanks.