module Llvm.Syntax.Parser.Basic ( module Text.Parsec , module Llvm.Syntax.Parser.Basic , module Control.Monad , module Text.Parsec.Perm ) where import Text.Parsec import Control.Monad import Llvm.Data.Ast import qualified Text.Parsec.Token as T import Text.Parsec.Language import Text.Parsec.Perm import Data.Char import Data.Functor.Identity (Identity) import qualified Data.Map as M import Data.Word (Word32) -- dummy state -- data DummyState = DummyState type DummyState = () type P a = Parsec String DummyState a initState :: DummyState initState = () -- DummyState lexer :: T.GenTokenParser String u Data.Functor.Identity.Identity lexer = T.makeTokenParser (emptyDef { T.commentLine = ";" , T.reservedNames = [ "begin", "end", "true", "false", "declare", "define", "global", "constant" , "dllimport", "dllexport" , "extern_weak", "external", "thread_local", "zeroinitializer", "undef", "null", "to", "tail" , "target", "triple", "deplibs", "datalayout", "volatile", "nuw", "nsw", "exact", "inbounds", "align" , "addrspace", "section", "alias", "module", "asm", "sideeffect", "gc", "ccc", "cc", "fastcc" , "coldcc", "x86_stdcallcc", "x86_fastcallcc", "x86_thiscallcc", "arm_apcscc", "arm_aapcscc", "arm_aapcs_vfpcc" , "msp430_intrcc", "cc", "c", "signext", "zeroext", "inreg", "sret", "nounwind", "noreturn", "noalias" , "nocapture", "byval", "nest", "type", "opaque", "eq", "ne", "slt", "sgt" , "sle", "sge", "ult", "ugt", "ule", "uge", "oeq", "one", "olt", "ogt", "ole", "oge", "ord", "uno", "ueq" , "une", "x", "blockaddress" , "add", "fadd", "sub", "fsub", "mul", "fmul", "udiv", "sdiv", "fdiv", "urem", "srem", "frem" , "shl", "lshr", "ashr", "and", "or", "xor", "icmp", "fcmp", "phi", "call", "trunc" , "zext", "sext", "fptrunc", "fpext", "uitofp", "sitofp", "fptoui", "fptosi", "inttoptr", "ptrtoint" , "bitcast", "addrspacecast", "select", "va_arg", "ret", "br", "switch", "indirectbr" , "invoke", "unwind", "unreachable" , "alloca", "malloc", "load", "store", "getelementptr", "extractelement", "insertelement", "shufflevector" , "getresult", "extractvalue", "insertvalue", "free", "address_safety", "nonlazybind", "landingpad", "cleanup" , "catch", "filter", "personality", "half", "unnamed_addr", "singlethread", "acquire" , "release", "acq_rel", "seq_cst", "unordered", "monotonic", "atomic" , "atomicrmw", "xchg", "nand", "max", "min", "umax", "umin", "x86_mmx" , "call", "tail", "musttail" -- Linkage Types , "private", "internal", "available_externally", "linkonce", "weak", "common", "appending", "extern_weak" , "linkonce_odr", "weak_odr", "external" -- Calling Conventions , "ccc", "fastcc", "coldcc", "cc", "webkit_jscc", "anyregcc", "preserve_mostcc", "preserve_allcc" , "spir_kernel", "spir_func", "intel_ocl_bicc", "x86_stdcallcc", "x86_fastcallcc", "x86_thiscallcc" , "arm_apcscc", "arm_aapcscc", "arm_aapcs_vfpcc", "msp430_intrcc", "ptx_kernel", "ptx_device" , "x86_64_win64cc", "x86_64_sysvcc" -- Visibility Styles , "default", "hidden", "protected" -- Parameter Attributes , "zeroext", "signext", "inreg", "byval", "inalloca", "sret", "noalias", "nocapture", "nest", "returned" , "nonnull", "dereferenceable" -- Function Attributes , "alignstack", "alwaysinline", "builtin", "cold", "inlinehint", "jumptable", "minsize", "naked", "nobuiltin" , "noduplicate", "noimplicitfloat", "noinline", "nonlazybind", "noredzone", "noreturn", "nounwind", "optnone" , "optsize", "readnone", "readonly", "returns_twice", "sanitize_address", "sanitize_memory", "sanitize_thread" , "ssp", "sspreq", "sspstrong", "uwtable" -- Fast math flags , "nnan", "ninf", "nsz", "arcp", "fast" , "inteldialect" , "<