never executed always true always false
1 module HelVM.HelMA.Automata.BrainFuck.Evaluator where
2
3 import qualified HelVM.HelMA.Automata.BrainFuck.Impl.Fast.Evaluator as Fast
4 import qualified HelVM.HelMA.Automata.BrainFuck.Impl.Flat.Evaluator as Flat
5 import qualified HelVM.HelMA.Automata.BrainFuck.Impl.Tree.Evaluator as Tree
6
7 import HelVM.HelMA.Automata.BrainFuck.API.BFType
8
9 import HelVM.HelMA.Automata.BrainFuck.Common.Symbol
10 import HelVM.HelMA.Automata.BrainFuck.Common.TapeOfSymbols
11
12 import HelVM.HelMA.Automaton.API.EvalParams
13 import HelVM.HelMA.Automaton.API.IOTypes
14
15 import HelVM.HelMA.Automaton.IO.BusinessIO
16
17 import HelVM.HelMA.Automaton.Types.CellType
18 import HelVM.HelMA.Automaton.Types.DumpType
19
20 simpleEval :: BIO m => (BFType , Source , CellType) -> m ()
21 simpleEval (c , s , t) = eval c s t Pretty --TODO Add MaybeLimit and use Trampoline
22
23 ----
24
25 evalParams :: BIO m => BFType -> EvalParams -> m ()
26 evalParams b p = eval b (source p) (cellAutoOptions p) (dumpAutoOptions p)
27
28 eval :: BIO m => BFType -> Source -> CellType -> DumpType -> m ()
29 eval c s Int8Type = evalSource c s (newTape :: FullTape Int8)
30 eval c s Word8Type = evalSource c s (newTape :: FullTape Word8)
31 eval c s Int16Type = evalSource c s (newTape :: FullTape Int16)
32 eval c s Word16Type = evalSource c s (newTape :: FullTape Word16)
33 eval c s Int32Type = evalSource c s (newTape :: FullTape Int32)
34 eval c s Word32Type = evalSource c s (newTape :: FullTape Word32)
35 eval c s Int64Type = evalSource c s (newTape :: FullTape Int64)
36 eval c s Word64Type = evalSource c s (newTape :: FullTape Word64)
37
38 evalSource :: (BIO m , Symbol e) => BFType -> Source -> FullTape e -> DumpType -> m ()
39 evalSource FastType = Fast.evalSource
40 evalSource TreeType = Tree.evalSource
41 evalSource FlatType = Flat.evalSource