open Extracted.Errors open Extracted.ErrorMessages let error_to_string = function | NotTerminated -> "NotTerminated" | AssemblyTooLarge -> "AssemblyTooLarge" | MISSING -> "MISSING" | EXTERNAL -> "EXTERNAL" | Jump_expansion_failed | ValueIsNotABoolean -> "ValueIsNotABoolean" | BadCast -> "BadCast" | BadlyTypedTerm -> "BadlyTypedTerm" | UnknownIdentifier -> "UnknownIdentifier" | BadLvalueTerm -> "BadLvalueTerm" | FailedLoad -> "FailedLoad" | FailedOp -> "FailedOp" | WrongNumberOfParameters -> "WrongNumberOfParameters" | FailedStore -> "FailedStore" | NonsenseState -> "NonsenseState" | ReturnMismatch -> "ReturnMismatch" | UnknownLabel -> "UnknownLabel" | BadFunctionValue -> "BadFunctionValue" | MainMissing -> "MainMissing" | UnknownField -> "UnknownField" | UndeclaredIdentifier -> "UndeclaredIdentifier" | BadlyTypedAccess -> "BadlyTypedAccess" | BadLvalue -> "BadLvalue" | MissingField -> "MissingField" | FIXME -> "FIXME" | MissingLabel -> "MissingLabel" | ParamGlobalMixup -> "ParamGlobalMixup" | DuplicateLabel -> "DuplicateLabel" | TypeMismatch -> "TypeMismatch" | UnknownLocal -> "UnknownLocal" | FailedConstant -> "FailedConstant" | BadState -> "BadState" | StoppedMidIO -> "StoppedMidIO" | UnsupportedOp -> "UnsupportedOp" | CorruptedPointer -> "CorruptedPointer" | NotATwoBytesPointer -> "NotATwoBytesPointer" | ValueNotABoolean -> "ValueNotABoolean" | NotAnInt32Val | WrongLength -> "WrongLength" | InitDataStoreFailed -> "InitDataStoreFailed" | DuplicateVariable -> "DuplicateVariable" | MissingId -> "MissingId" | IllTypedEvent -> "IllTypedEvent" | InternalStackFull -> "InternalStackFull" | InternalStackEmpty -> "InternalStackEmpty" | BadProgramCounter -> "BadProgramCounter" | ProgramCounterOutOfCode -> "ProgramCounterOutOfCode" | PointNotFound -> "PointNotFound" | LabelNotFound -> "LabelNotFound" | MissingSymbol -> "MissingSymbol" | BadFunction -> "BadFunction" | SuccessorNotProvided -> "SuccessorNotProvided" | BadPointer -> "BadPointer" | NoSuccessor -> "NoSuccessor" | MissingStackSize -> "MissingStackSize" | ExternalMain -> "ExternalMain" | BadRegister -> "BadRegister" | BadMain -> "BadMain" | MissingRegister -> "MissingRegister" | MissingStatement -> "MissingStatement" | BadJumpTable -> "BadJumpTable" | BadJumpValue -> "BadJumpValue" | FinalState -> "FinalState" | EmptyStack -> "EmptyStack" | OutOfBounds -> "OutOfBounds" | UnexpectedIO -> "UnexpectedIO" | TerminatedEarly -> "TerminatedEarly" | RepeatedCostLabel -> "RepeatedCostLabel" | BadCostLabelling -> "BadCostLabelling" | FunctionNotFound -> "FunctionNotFound" | FrameErrorOnPop -> "FrameErrorOnPop" | FrameErrorOnPush -> "FrameErrorOnPush" | BlockInFramesCorrupted -> "BlockInFramesCorrupted" | FramesEmptyOnPop -> "FramesEmptyOnPop" | RepeatedCostLabel0 -> "RepeatedCostLabel0" | StackOverflow -> "StackOverflow" let rec conv_list l = (match l with | Extracted.List.Nil -> [ ] | Extracted.List.Cons (h, t) -> h::conv_list t) let errormsg m = String.concat " " (conv_list (Extracted.List.map (function Extracted.Errors.MSG e -> error_to_string e | _ -> "") m))