Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let mystere x =
- let (%) x y = if x < 0 then y-1 else x mod y in
- let ($) x y = if x = y then 1 else -1 in
- let t = Array.make 30000 0 in
- let f = open_in x in
- let rec aux i l =
- try let c = input_char f in match c with
- | '>' | '<' -> aux ((i+(c$'>'))%30000) l
- | '[' -> aux i ((pos_in f)::l)
- | ']' -> let h::q = l in
- if t.(i) = 0 then aux i q
- else (seek_in f h; aux i l)
- |_->(match c with
- | '+' | '-' -> t.(i) <- (t.(i)+(c$'+'))%256
- | '.' -> print_char (Char.chr t.(i)); flush stdout
- | ',' -> t.(i) <- Char.code (input_char stdin)
- |_->()); aux i l
- with _ -> close_in f
- in aux 0 [] ;;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement