never executed always true always false
1 module HelVM.HelMA.Automata.SubLeq.Evaluator (
2 simpleEval,
3 evalParams,
4 ) where
5
6 import HelVM.HelMA.Automata.SubLeq.Automaton
7 import HelVM.HelMA.Automata.SubLeq.Lexer
8
9 import HelVM.HelMA.Automaton.API.EvalParams
10 import HelVM.HelMA.Automaton.API.IOTypes
11
12 import HelVM.HelMA.Automaton.IO.AutomatonIO
13 import HelVM.HelMA.Automaton.IO.BusinessIO
14
15 import HelVM.HelMA.Automaton.Trampoline
16
17 import HelVM.HelMA.Automaton.Types.DumpType
18 import HelVM.HelMA.Automaton.Types.RAMType
19
20 import qualified HelVM.HelIO.Collections.MapList as MapList
21 import qualified HelVM.HelIO.Collections.SList as SList
22
23 import qualified Data.Sequence as Seq
24
25 simpleEval :: BIO m => RAMType -> Source -> m ()
26 simpleEval rt s = evalSource s rt testMaybeLimit Pretty
27
28 ----
29
30 evalParams :: BIO m => EvalParams -> m ()
31 evalParams p = evalSource (source p) (ramAutoOptions p) Nothing (dumpAutoOptions p)
32
33 evalSource :: BIO m => Source -> RAMType -> LimitMaybe -> DumpType -> m ()
34 evalSource source = evalIL $ tokenize source
35
36 evalIL :: AutomatonIO e m => [e] -> RAMType -> LimitMaybe -> DumpType -> m ()
37 evalIL = flip evalIL'
38
39 evalIL' :: AutomatonIO e m => RAMType -> [e] -> LimitMaybe -> DumpType -> m ()
40 evalIL' ListRAMType = start
41 evalIL' SeqRAMType = start . Seq.fromList
42 evalIL' SListRAMType = start . SList.sListFromList
43 evalIL' MapListRAMType = start . MapList.mapListFromList
44
45 start :: RAutomatonIO e r m => r -> LimitMaybe -> DumpType -> m ()
46 start r limit dt = logDump dt =<< run limit (newMemory r)