sequence_ [printf "%s" (show x) | x <- parsed]
-parseInstr :: [DictLabel] -> [DTF] -> [DTF]
+parseInstr :: [DictElem] -> [DTF] -> [DTF]
parseInstr _ [] = []
parseInstr dict ((DTF_InstrToParse a instr c l s):xs) =
(DTF_Instr a bytecode c l s):(parseInstr dict xs)
where
- bytecode = case (parse (instruction dict) "" (instr++"\n")) of
+ bytecode = case (parse (instruction (a,dict)) "" (instr++"\n")) of
Left err -> error ("couldn't parse Instruction: " ++ instr ++ "\n" ++ show err)
Right x -> x
parseInstr dict (x:xs) = x:(parseInstr dict xs)
inc = ((+) 4)
-convertDTF :: [(Int,String)] -> DT_State -> Counter -> Counter -> [DictLabel] -> ([DictLabel], [DTF])
+convertDTF :: [(Int,String)] -> DT_State -> Counter -> Counter -> [DictElem] -> ([DictElem], [DTF])
convertDTF [] _ _ _ d = (d,[])
convertDTF ((lno,str):xs) state datacnt instrcnt dict = (newdict, (actlist newdtf))
where
nstate (DTF_State s) = s
nstate _ = state
- ndict (DTF_Label l _ a) = dict `add_label` (l,a)
- ndict (DTF_SectionToDet a _ _ l _) = dict `add_label` (l,a)
- ndict (DTF_InstrToParse a _ _ l _) = dict `add_label` (l,a)
- ndict (DTF_Data a _ _ l _) = dict `add_label` (l,a)
- ndict (DTF_Instr a _ _ l _) = dict `add_label` (l,a)
+ ndict (DTF_Label l _ a) = dict `add_elem` (l,a)
+ ndict (DTF_SectionToDet a _ _ l _) = dict `add_elem` (l,a)
+ ndict (DTF_InstrToParse a _ _ l _) = dict `add_elem` (l,a)
+ ndict (DTF_Data a _ _ l _) = dict `add_elem` (l,a)
+ ndict (DTF_Instr a _ _ l _) = dict `add_elem` (l,a)
ndict _ = dict
newdtf = case (parse parseDTFLine "" (str++"\n")) of