| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Language.QBE
Description
This module provides top-level definitions for representing programs written in the QBE intermediate representation.
Synopsis
- type Program = [Definition]
- data Definition
- globalFuncs :: Program -> [FuncDef]
- parse :: SourceName -> String -> Either ParseError Program
- data ExecError
- parseAndFind :: MonadThrow m => GlobalIdent -> String -> m (Program, FuncDef)
Documentation
type Program = [Definition] Source #
A parsed QBE program, represented as a list of Definition values.
data Definition Source #
A QBE program consists of a sequence of definitions. Four types of objects can be defined: aggregate types, data, functions, and debugging information.
See also: The corresponding section of the QBE specification.
Constructors
| DefData DataDef | Definition of data (e.g. a string). |
| DefType TypeDef | Definition of an aggregate data type. |
| DefFunc FuncDef | Definition of a function. |
| DefFile String | Definition of a debug file. |
Instances
| Show Definition Source # | |
Defined in Language.QBE Methods showsPrec :: Int -> Definition -> ShowS # show :: Definition -> String # showList :: [Definition] -> ShowS # | |
| Eq Definition Source # | |
Defined in Language.QBE | |
globalFuncs :: Program -> [FuncDef] Source #
Utility function to obtain all functions defined in a QBE Program.
parse :: SourceName -> String -> Either ParseError Program Source #
Wrapper to parse a QBE program using parse.
Custom Exception used for error handling in parseAndFind.
Constructors
| ESyntaxError ParseError | The input is not a valid QBE program. |
| EUnknownEntry GlobalIdent | The given entry function is not defined in the QBE program. |
Instances
| Exception ExecError Source # | |
Defined in Language.QBE Methods toException :: ExecError -> SomeException # fromException :: SomeException -> Maybe ExecError # displayException :: ExecError -> String # | |
| Show ExecError Source # | |
parseAndFind :: MonadThrow m => GlobalIdent -> String -> m (Program, FuncDef) Source #