[Haddock generated documentation igor@bytelabs.org**20070811140817] { adddir ./api addfile ./api/Ast-Attr.html addfile ./api/Ast-Bind.html addfile ./api/Ast-Code.html addfile ./api/Ast-Decl.html addfile ./api/Ast-Def.html addfile ./api/Ast-Ident.html addfile ./api/Ast-Incl.html addfile ./api/Ast-Node.html addfile ./api/Ast-Nt.html addfile ./api/Ast-Op.html addfile ./api/Ast-Prod.html addfile ./api/Ast-T.html addfile ./api/Ast-TermTy.html addfile ./api/Csa-Csa.html addfile ./api/Debug.html addfile ./api/Env-Elem.html addfile ./api/Env-Env.html addfile ./api/Gen-Emit-EmitClass.html addfile ./api/Gen-Emit-EmitEnums.html addfile ./api/Gen-Emit-EmitEval.html addfile ./api/Gen-Emit-EmitMapEntry.html addfile ./api/Gen-Emit-EmitNodeIf.html addfile ./api/Gen-Emit-EmitTiling.html addfile ./api/Gen-Emit-Java-JComment.html addfile ./api/Gen-Emit-Java-JConstructor.html addfile ./api/Gen-Emit-Java-JEnum.html addfile ./api/Gen-Emit-Java-JMethod.html addfile ./api/Gen-Emit-Java-JModifier.html addfile ./api/Gen-Emit-Java-JParameter.html addfile ./api/Gen-Emit-Java-JVariable.html addfile ./api/Gen-Emit-Java-Java.html addfile ./api/Gen-Emit-JavaClass.html addfile ./api/Gen-Emit-Label.html addfile ./api/Gen-Emit-Tiling.html addfile ./api/Gen-Emit.html addfile ./api/Main.html addfile ./api/Parser-Lexer.html addfile ./api/Parser-ParseErr.html addfile ./api/Parser-Parser.html addfile ./api/Util.html addfile ./api/doc-index-A.html addfile ./api/doc-index-B.html addfile ./api/doc-index-C.html addfile ./api/doc-index-D.html addfile ./api/doc-index-E.html addfile ./api/doc-index-G.html addfile ./api/doc-index-H.html addfile ./api/doc-index-I.html addfile ./api/doc-index-J.html addfile ./api/doc-index-L.html addfile ./api/doc-index-M.html addfile ./api/doc-index-N.html addfile ./api/doc-index-O.html addfile ./api/doc-index-P.html addfile ./api/doc-index-R.html addfile ./api/doc-index-S.html addfile ./api/doc-index-T.html addfile ./api/doc-index-U.html addfile ./api/doc-index.html addfile ./api/haddock.css addfile ./api/haddock.js addfile ./api/haskell_icon.gif addfile ./api/index.html addfile ./api/minus.gif addfile ./api/plus.gif hunk ./api/Ast-Attr.html 1 + + +
| |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
| Description | |||||||||||||||||||||||||||
Author : Igor Boehm igor@bytelabs.org + This module includes the necessary abstractions in order to allow + for an attribute grammar formalism in our tree pattern language. + It represents an attribute with its operations: + * e.g.: nt : (in|out) Type ident : + | |||||||||||||||||||||||||||
| Synopsis | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
| Introduction + | |||||||||||||||||||||||||||
| data Attr | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
| data Ty | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
| data AttrTy | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
| Construction + | |||||||||||||||||||||||||||
| new :: Ident -> AttrTy -> Ty -> Attr | |||||||||||||||||||||||||||
| Create new attribute + | |||||||||||||||||||||||||||
| ty :: Ident -> Ty | |||||||||||||||||||||||||||
| Create attribute type + | |||||||||||||||||||||||||||
| emptyTy :: Ty | |||||||||||||||||||||||||||
| Create empty attribute type + | |||||||||||||||||||||||||||
| Functions + | |||||||||||||||||||||||||||
| attrTy :: Attr -> Ty | |||||||||||||||||||||||||||
| attrId :: Attr -> Ident | |||||||||||||||||||||||||||
| attrIsOut :: Attr -> Bool | |||||||||||||||||||||||||||
| attrGetIn :: [Attr] -> [Attr] | |||||||||||||||||||||||||||
| attrGetOut :: [Attr] -> [Attr] | |||||||||||||||||||||||||||
| attrEqualInOut :: [Attr] -> [Attr] -> Bool | |||||||||||||||||||||||||||
| Produced by Haddock version 0.8 |
| |||||||||
| |||||||||
| |||||||||
| Description | |||||||||
Author : Igor Boehm igor@bytelabs.org + Terminals and NonTerminals can be refered to in Semantic Actions by + supplying binding identifiers: + * Example: > nt = t t1 (: t1.toString(); :) + t1 is associated with the current incarnation of t and can + be used within a semantic action in order to refer to t. + | |||||||||
| Synopsis | |||||||||
| |||||||||
| Types + | |||||||||
| data Binding | |||||||||
| |||||||||
| Construction + | |||||||||
| new :: Ident -> Binding | |||||||||
| empty :: Binding | |||||||||
| Functions + | |||||||||
| hasBinding :: Binding -> Bool | |||||||||
| getIdent :: Binding -> Ident | |||||||||
| Produced by Haddock version 0.8 |
| |||||||
| |||||||
| |||||||
| Description | |||||||
Author : Igor Boehm igor@bytelabs.org + The target code within a semantic action is represented by this module: + * Example: '(: .... :)' + the stuff between '(:' and ':)' is target code. + | |||||||
| Synopsis | |||||||
| |||||||
| Types + | |||||||
| data Code | |||||||
| |||||||
| Construction + | |||||||
| new :: String -> Code | |||||||
| empty :: Code | |||||||
| Functions + | |||||||
| isEmpty :: Code -> Bool | |||||||
| Produced by Haddock version 0.8 |
| ||||
| ||||
| ||||
| Description | ||||
Author : Igor Boehm igor@bytelabs.org + Target code specified in the declaration section of the tree pattern + matching language. + | ||||
| Synopsis | ||||
| ||||
| Introduction + | ||||
| data Declaration | ||||
| ||||
| Construction + | ||||
| new :: Code -> Declaration | ||||
| Produced by Haddock version 0.8 |
| |||||||||||||||||||
| |||||||||||||||||||
| |||||||||||||||||||
| Description | |||||||||||||||||||
Author : Igor Boehm igor@bytelabs.org + This module provides the necessary abstractions to work with definitions. + Each non terminal must be defined and consists of one or more productions: + * Example: nt = prod1 + | prod2 + | ... + | prodN . + | |||||||||||||||||||
| Synopsis | |||||||||||||||||||
| |||||||||||||||||||
| Types + | |||||||||||||||||||
| data Definition | |||||||||||||||||||
| |||||||||||||||||||
| Construction + | |||||||||||||||||||
| new :: Ident -> [Attr] -> Code -> [Prod] -> Definition | |||||||||||||||||||
| Construct a non terminal + | |||||||||||||||||||
| Functions + | |||||||||||||||||||
| getCode :: Definition -> Code | |||||||||||||||||||
| getProds :: Definition -> [Prod] | |||||||||||||||||||
| getClosures :: Definition -> Closure | |||||||||||||||||||
| Array of Def nodes we have to hook up with + | |||||||||||||||||||
| getNodeReturnType :: [Definition] -> Node -> Maybe Nt | |||||||||||||||||||
| Given all definitions and a Node, the return 'type' if the Node + is calculated. + | |||||||||||||||||||
| getDefForProd :: [Definition] -> Prod -> Maybe Definition | |||||||||||||||||||
| Get definition for an NonTerm Prod. + | |||||||||||||||||||
| setProds :: Definition -> [Prod] -> Definition | |||||||||||||||||||
| isNodeDefined :: [Definition] -> Node -> Bool | |||||||||||||||||||
| Check if a production is defined + | |||||||||||||||||||
| mergeDefs :: [Definition] -> Definition -> Either (Node, Node) [Definition] | |||||||||||||||||||
| Merge definitions together + | |||||||||||||||||||
| Produced by Haddock version 0.8 |
| |||||
| |||||
| |||||
| Description | |||||
Author : Igor Boehm igor@bytelabs.org + User defined identifiers of all kinds are represented by this module. + Examples of identifiers: + * bindings + * terminal and non terminal names + | |||||
| Synopsis | |||||
| |||||
| Types + | |||||
| data Ident | |||||
| |||||
| Construction + | |||||
| new :: String -> Ident | |||||
| Functions + | |||||
| toIdent :: Token -> Ident | |||||
| Produced by Haddock version 0.8 |
| ||||
| ||||
| ||||
| Description | ||||
Author : Igor Boehm igor@bytelabs.org + Target code specified in the include section of the tree pattern + matching language. + | ||||
| Synopsis | ||||
| ||||
| Types + | ||||
| data Include | ||||
| ||||
| Construction + | ||||
| new :: Code -> Include | ||||
| Produced by Haddock version 0.8 |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Author : Igor Boehm igor@bytelabs.org + The input tree pattern matching grammar specification is converted into an + AST where this module, an AST node, is the primary substrate. + | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Synopsis | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Classes + | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| class NodeClass a where | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Types + | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| data Node | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Construction + | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| new :: TermTy -> Code -> Code -> Node -> Code -> Node -> Code -> Node | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Constructor for building a Node + | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Functions + | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| addLinkBlockCode :: Node -> Code -> Code -> Node | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Adds semantic action contained in link block + | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| setLink :: Node -> Node -> Node | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| getName :: Node -> String | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| getTy :: Node -> Maybe TermTy | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| getIdent :: Node -> Maybe Ident | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| getLink :: Node -> Node | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| getSem1 :: Node -> Code | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| getSem2 :: Node -> Code | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| getSem3 :: Node -> Code | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| getSem4 :: Node -> Code | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| getSem5 :: Node -> Code | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| getSem6 :: Node -> Code | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| equalIdents :: Node -> Node -> Bool | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Compare Nodes based on identifiers + | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| hasLink :: Node -> Bool | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| showAsFunction :: Node -> String | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Shows a node like a function 'name (child1, child2, etc.)' + | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| AST traversal functions + | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| mapPreOrder :: (Node -> a) -> Node -> [a] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| mapPreOrder. + | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| mapPreOrder2 :: (Int -> Node -> [a]) -> (Node -> b) -> Node -> [([a], b)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Note: The root is node is NOT processed! Processing starts from roots children. + | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| mapPreOrder3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
| mapChildren :: (Int -> Node -> a) -> Node -> [a] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| mapChildren. + | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Produced by Haddock version 0.8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||
| |||||||||||
| |||||||||||
| Description | |||||||||||
Author : Igor Boehm igor@bytelabs.org + Representation of a non terminal in our tree pattern matching grammar. + | |||||||||||
| Synopsis | |||||||||||
| |||||||||||
| Types + | |||||||||||
| data Nt | |||||||||||
| |||||||||||
| Construction + | |||||||||||
| new :: Ident -> Binding -> [Attr] -> Nt | |||||||||||
| Construct a non terminal + | |||||||||||
| Functions + | |||||||||||
| getIdent :: Nt -> Ident | |||||||||||
| getAttr :: Nt -> [Attr] | |||||||||||
| getBinding :: Nt -> Binding | |||||||||||
| hasBinding :: Nt -> Bool | |||||||||||
| Produced by Haddock version 0.8 |
| |||||||||||
| |||||||||||
| |||||||||||
| Description | |||||||||||
Author : Igor Boehm igor@bytelabs.org + This module represents an operator. Operators are defined in the operator + section of the tree pattern matching language. Operators need to be defined + for two reasons: + * CSA + * the ability to abstract away from the target language specific representation + of an operator and the name used in the tree pattern matching grammar + e.g.: ADD (: E_ADD :) would define the operator ADD which has a + target language specific definition, namely E_ADD. + | |||||||||||
| Synopsis | |||||||||||
| |||||||||||
| Types + | |||||||||||
| data Operator | |||||||||||
| |||||||||||
| Construction + | |||||||||||
| op :: Ident -> Operator | |||||||||||
| Create Operator from Ident + | |||||||||||
| opMap :: Ident -> Code -> Operator | |||||||||||
| Create Operator from Ident and Code + | |||||||||||
| opSem :: Operator -> Code | |||||||||||
| retrieve semantic action possibly attached to operator + | |||||||||||
| Functions + | |||||||||||
| opHasSem :: Operator -> Bool | |||||||||||
| query if operator has a semantic action attached to it + | |||||||||||
| opId :: Operator -> Ident | |||||||||||
| retrieve operator token + | |||||||||||
| Produced by Haddock version 0.8 |
| |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
| Description | |||||||||||||||||||||||||||||
Author : Igor Boehm igor@bytelabs.org + Each definition consists of one or more productions. This module provides + the necessary abstractions to deal with productions: + * e.g.: def = prod1 + | prod2 + | ... + | prodN + | |||||||||||||||||||||||||||||
| Synopsis | |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
| Types + | |||||||||||||||||||||||||||||
| type Cost = Int | |||||||||||||||||||||||||||||
| Cost for a production + | |||||||||||||||||||||||||||||
| data Prod | |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
| Construction + | |||||||||||||||||||||||||||||
| prod :: Node -> Cost -> Prod | |||||||||||||||||||||||||||||
| Constructor for building a production + | |||||||||||||||||||||||||||||
| Functions + | |||||||||||||||||||||||||||||
| getName :: Prod -> String | |||||||||||||||||||||||||||||
| getProdsByIdent :: [Prod] -> Node -> [Prod] | |||||||||||||||||||||||||||||
| Retrieves all productions which have the same identifier + | |||||||||||||||||||||||||||||
| getArity :: Prod -> Int | |||||||||||||||||||||||||||||
| getNode :: Prod -> Node | |||||||||||||||||||||||||||||
| getCost :: Prod -> Cost | |||||||||||||||||||||||||||||
| getRuleLabel :: Prod -> RuleLabel | |||||||||||||||||||||||||||||
| getResultLabel :: Prod -> ResultLabel | |||||||||||||||||||||||||||||
| setRuleLabel :: Prod -> RuleLabel -> Prod | |||||||||||||||||||||||||||||
| setResultLabel :: Prod -> ResultLabel -> Prod | |||||||||||||||||||||||||||||
| toOp :: Prod -> Operator | |||||||||||||||||||||||||||||
| isDefined :: [Prod] -> Node -> Bool | |||||||||||||||||||||||||||||
| mergeProds :: [Prod] -> Prod -> Either (Node, Node) [Prod] | |||||||||||||||||||||||||||||
| Merges productions iff productions with the same name, have the same amount of parameters + | |||||||||||||||||||||||||||||
| Produced by Haddock version 0.8 |
| |||||||||
| |||||||||
| |||||||||
| Description | |||||||||
Author : Igor Boehm igor@bytelabs.org + Representation of a terminal in our tree pattern matching grammar. + | |||||||||
| Synopsis | |||||||||
| |||||||||
| Types + | |||||||||
| data T | |||||||||
| |||||||||
| Construction + | |||||||||
| new :: Ident -> Binding -> T | |||||||||
| Constructor for creating a T + | |||||||||
| Functions + | |||||||||
| getIdent :: T -> Ident | |||||||||
| getBinding :: T -> Binding | |||||||||
| hasBinding :: T -> Bool | |||||||||
| Produced by Haddock version 0.8 |
| ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| Description | ||||||||||||||||||||||||||
Author : Igor Boehm igor@bytelabs.org + This module provides the necessary abstractions to deal with terminals + and non terminals in a uniform and generic way. Thus a TermTy can either + be a terminal of type T or a non terminal of type Nt. + | ||||||||||||||||||||||||||
| Synopsis | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| Classes + | ||||||||||||||||||||||||||
| class TermTyClass a where | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| Types + | ||||||||||||||||||||||||||
| data TermTy | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| Construction + | ||||||||||||||||||||||||||
| term :: T -> TermTy | ||||||||||||||||||||||||||
| Construct TermTy out of T + | ||||||||||||||||||||||||||
| nonTerm :: Nt -> TermTy | ||||||||||||||||||||||||||
| Construct TermTy out o f Nt + | ||||||||||||||||||||||||||
| Produced by Haddock version 0.8 |
| |||||
| |||||
| |||||
| Description | |||||
Author : Igor Boehm igor@bytelabs.org + This module contains various semantic analysis functions used + during the process of parsing the tree pattern matching language + specification. Tree pattern typechecking is also implemented in + this module. + | |||||
| Synopsis | |||||
| |||||
| Functions + | |||||
| updateEnv :: TermTy -> Env -> Either (Elem, Elem) Env | |||||
| If Binding for TermTy is not in the Env return Right with + updated Env, otherwise return Left indicating the two culprits + | |||||
| checkEnv :: [Definition] -> Env -> Maybe [String] | |||||
| Checks if all nodes have been defined. Returns Nothing if checks succeed, + or a 'Just [String]' where '[String]' contains the the error messages. + | |||||
| checkDef :: Definition -> Maybe String | |||||
| Checks if a definition contains the following: + nt = nt1 + | nt2 + | nt <-- This is the error case since a definition is being defined in terms of itself + | nt3. + | |||||
| Produced by Haddock version 0.8 |
| |||||||
| |||||||
| |||||||
| Description | |||||||
Author : Igor Boehm igor@bytelabs.org + Data which can output debugging information about itself should implement + the Debug(..) class. + | |||||||
| Synopsis | |||||||
| |||||||
| Classes + | |||||||
| class Show a => Debug a where | |||||||
| |||||||
| Produced by Haddock version 0.8 |
| |||||||||||||||||||||
| |||||||||||||||||||||
| |||||||||||||||||||||
| Description | |||||||||||||||||||||
Author : Igor Boehm igor@bytelabs.org + Am Elem is defined as an existential type in order to hold heterogeneous + values which then get stuffed into an Environment (Env). + | |||||||||||||||||||||
| Synopsis | |||||||||||||||||||||
| |||||||||||||||||||||
| Classes + | |||||||||||||||||||||
| class (Eq a, Ord a, Show a) => ElemClass a where | |||||||||||||||||||||
| |||||||||||||||||||||
| data ElemType | |||||||||||||||||||||
| |||||||||||||||||||||
| Types + | |||||||||||||||||||||
| data Elem | |||||||||||||||||||||
| |||||||||||||||||||||
| Functions + | |||||||||||||||||||||
| envElem :: ElemClass a => a -> Elem | |||||||||||||||||||||
| Constructor for creating Elems + | |||||||||||||||||||||
| Produced by Haddock version 0.8 |
| |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
| Description | |||||||||||||||||||||||||||||||||||
Author : Igor Boehm igor@bytelabs.org + Env is used heavily during CSA. It is stuffed with Elements and helps + to discover things like duplicate or missing definitions and bindings. + | |||||||||||||||||||||||||||||||||||
| Synopsis | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
| Classes + | |||||||||||||||||||||||||||||||||||
| class (Eq a, Ord a, Show a) => ElemClass a where | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
| data ElemType | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
| Types + | |||||||||||||||||||||||||||||||||||
| data Env | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
| data Elem | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
| Construction + | |||||||||||||||||||||||||||||||||||
| newEnv :: Elem -> Env | |||||||||||||||||||||||||||||||||||
| Constructor for creating an Env with one element + | |||||||||||||||||||||||||||||||||||
| emptyEnv :: Env | |||||||||||||||||||||||||||||||||||
| Constructor for creating an empty Env + | |||||||||||||||||||||||||||||||||||
| Functions + | |||||||||||||||||||||||||||||||||||
| addToEnv :: Env -> Elem -> Env | |||||||||||||||||||||||||||||||||||
| Adds Elem to an environment. If Elem already exists it will be overwritten. + | |||||||||||||||||||||||||||||||||||
| inEnv :: Env -> Elem -> Bool | |||||||||||||||||||||||||||||||||||
| Checks whether Elem already exists in Env + | |||||||||||||||||||||||||||||||||||
| getElem :: Env -> Elem -> Maybe Elem | |||||||||||||||||||||||||||||||||||
| Checks whether Elem already exists in Env and if it does it returns it. + | |||||||||||||||||||||||||||||||||||
| envElem :: ElemClass a => a -> Elem | |||||||||||||||||||||||||||||||||||
| Constructor for creating Elems + | |||||||||||||||||||||||||||||||||||
| mergeEnvs :: Env -> Env -> Either (Elem, Elem) Env | |||||||||||||||||||||||||||||||||||
| Merges two Envs. If there are clashes return Left Elem which indicates + which element was the culprit. Otherwise return Right Env. + | |||||||||||||||||||||||||||||||||||
| Produced by Haddock version 0.8 |
| ||||||||||
| ||||||||||
| ||||||||||
| Description | ||||||||||
Author : Igor Boehm igor@bytelabs.org + Every class should know how to emit itself and where it belongs. + | ||||||||||
| Synopsis | ||||||||||
| ||||||||||
| Classes + | ||||||||||
| class EmitClass a where | ||||||||||
| ||||||||||
| Produced by Haddock version 0.8 |
| ||||
| ||||
| ||||
| Description | ||||
Author : Igor Boehm igor@bytelabs.org + The resulting code uses enumerations for non terminals and rule labels. This + module is responsible for the creation of such Enumerations. It also modifies + the definition AST since the Rule labels used during the tiling and evaluation + phase are assigned here. + | ||||
| Synopsis | ||||
| ||||
| Functions + | ||||
| genEnums :: Package -> [Definition] -> ([Definition], [Java]) | ||||
| Generates all necessary enumerations. + | ||||
| Produced by Haddock version 0.8 |
| ||||
| ||||
| ||||
| Description | ||||
Author : Igor Boehm igor@bytelabs.org + TODO: Write short summary + | ||||
| Synopsis | ||||
| ||||
| Functions + | ||||
| genEval :: Declaration -> [Definition] -> Java -> Java | ||||
| This function is the top level function for generating the Target Source Code of the code emission. + | ||||
| Produced by Haddock version 0.8 |
| ||||
| ||||
| ||||
| Description | ||||
Author : Igor Boehm igor@bytelabs.org + Since Java does not support tuples, it is necessary to wrap up data (which one + would normally put into a Tuple) in a class. This is what this module emits, + a class which holds two values, the cost and the rule number. + Each AST node in the target language has a map mapping non terminals + defined in the tree pattern matching language grammar to costs + and values, it looks something like: + * EnumMapNT, MapEntry> table = new EnumMap<NT, MapEntry(); + Thus a MapEntry serves as a Tuple holding cost und rule number. + | ||||
| Synopsis | ||||
| ||||
| Functions + | ||||
| genMapEntry :: Package -> Java | ||||
| Generates MapEntry Java class + | ||||
| Produced by Haddock version 0.8 |
| ||||
| ||||
| ||||
| Description | ||||
Author : Igor Boehm igor@bytelabs.org + Depending on the tree pattern matching grammar specification, the + correct AST node Java interface is emitted by this module. + | ||||
| Synopsis | ||||
| ||||
| Functions + | ||||
| genNodeInterface :: Package -> Children -> Link -> KindReturn -> Java | ||||
| Generates Java Node Interface class. + | ||||
| Produced by Haddock version 0.8 |
| ||||
| ||||
| ||||
| Description | ||||
Author : Igor Boehm igor@bytelabs.org + This module generates tiling target source code and the appropriate + Java node interface. + | ||||
| Synopsis | ||||
| ||||
| Functions + | ||||
| genTiling :: [Operator] -> [Definition] -> NodeKind -> Java -> (Java, Java) | ||||
| Top level function for generating tiling target source code and the appropriate node interface. + | ||||
| Produced by Haddock version 0.8 |
| ||||
| ||||
| ||||
| Description | ||||
Author : Igor Boehm igor@bytelabs.org + Java comments. + | ||||
| Synopsis | ||||
| ||||
| Types + | ||||
| data JComment | ||||
| ||||
| Construction + | ||||
| new :: [String] -> JComment | ||||
| Constructor for building a comment + | ||||
| Produced by Haddock version 0.8 |
| |||||
| |||||
| |||||
| Description | |||||
Author : Igor Boehm igor@bytelabs.org + Java constructor. + | |||||
| Synopsis | |||||
| |||||
| Types + | |||||
| data JConstructor | |||||
| |||||
| Construction + | |||||
| new :: JModifier -> String -> [Parameter] -> Body -> JConstructor | |||||
| Constructor for building a JConstructor + | |||||
| Produced by Haddock version 0.8 |
| ||||
| ||||
| ||||
| Description | ||||
Author : Igor Boehm igor@bytelabs.org + Java enumeration. + | ||||
| Synopsis | ||||
| ||||
| Types + | ||||
| data JEnum | ||||
| ||||
| Construction + | ||||
| new :: JModifier -> String -> [String] -> JEnum | ||||
| Constructor for building a JModifier + | ||||
| Produced by Haddock version 0.8 |
| |||||||||||||
| |||||||||||||
| |||||||||||||
| Description | |||||||||||||
Author : Igor Boehm igor@bytelabs.org + Java method. + | |||||||||||||
| Synopsis | |||||||||||||
| |||||||||||||
| Types + | |||||||||||||
| data JMethod | |||||||||||||
| |||||||||||||
| Construction + | |||||||||||||
| new :: JModifier -> Bool -> Type -> String -> [JParameter] -> Body -> JMethod | |||||||||||||
| Constructor for building a JMethod. + | |||||||||||||
| Functions + | |||||||||||||
| getName :: JMethod -> String | |||||||||||||
| getRetTy :: JMethod -> Type | |||||||||||||
| getParams :: JMethod -> [JParameter] | |||||||||||||
| setComment :: JMethod -> JComment -> JMethod | |||||||||||||
| setIfaceDef :: JMethod -> Bool -> JMethod | |||||||||||||
| Produced by Haddock version 0.8 |
| |||||||||||||
| |||||||||||||
| |||||||||||||
| Description | |||||||||||||
Author : Igor Boehm igor@bytelabs.org + Java modifiers. + | |||||||||||||
| Synopsis | |||||||||||||
| |||||||||||||
| Types + | |||||||||||||
| data JModifier | |||||||||||||
| |||||||||||||
| Produced by Haddock version 0.8 |
| |||||||||
| |||||||||
| |||||||||
| Description | |||||||||
Author : Igor Boehm igor@bytelabs.org + Java parameter type. + | |||||||||
| Synopsis | |||||||||
| |||||||||
| Types + | |||||||||
| data JParameter | |||||||||
| |||||||||
| Construction + | |||||||||
| new :: Type -> Ident -> JParameter | |||||||||
| Constructor for building a new JParameter + | |||||||||
| newFromList :: [(Type, Ident)] -> [JParameter] | |||||||||
| Functions + | |||||||||
| getIdent :: JParameter -> Ident | |||||||||
| getType :: JParameter -> Type | |||||||||
| Produced by Haddock version 0.8 |
| ||||
| ||||
| ||||
| Description | ||||
Author : Igor Boehm igor@bytelabs.org + Java variable type. + | ||||
| Synopsis | ||||
| ||||
| Types + | ||||
| data JVariable | ||||
| ||||
| Construction + | ||||
| new :: JModifier -> Bool -> Type -> String -> Constructor -> JVariable | ||||
| Constructor for building a new JVariable + | ||||
| Produced by Haddock version 0.8 |
| ||||
| ||||
| ||||
| Description | ||||
Author : Igor Boehm igor@bytelabs.org + This module implements the JavaClass type class and + represents a Java class (e.g. regular class, interface, enumration) + | ||||
| Synopsis | ||||
| ||||
| Types + | ||||
| data Java | ||||
| ||||
| Construction + | ||||
| java :: Package -> Name -> Java | ||||
| java. Smart constructor. + | ||||
| Produced by Haddock version 0.8 |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Author : Igor Boehm igor@bytelabs.org + Type Class which captures most of the features a Java Class provides. + More information on how to nest Java Classes in various ways + can be found at: + * http://en.wikibooks.org/wiki/Java_Programming/Nested_Classes + * http://java.sun.com/docs/books/tutorial/java/javaOO/nested.html + | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Synopsis | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Classes + | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| class EmitClass a => JavaClass a where | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Produced by Haddock version 0.8 |
| |||||||||||||||
| |||||||||||||||
| |||||||||||||||
| Description | |||||||||||||||
Author : Igor Boehm igor@bytelabs.org + Non terminals defined in our tree pattern matching language, as well as + rule labels generated during the tiling phase, and others use these + functions in order to guarantee consistent naming. + | |||||||||||||||
| Synopsis | |||||||||||||||
| |||||||||||||||
| Types + | |||||||||||||||
| type Label = String | |||||||||||||||
| Functions + | |||||||||||||||
| tTyToEnumLabel :: TermTy -> Label | |||||||||||||||
| Generate label for TermTy + | |||||||||||||||
| ntToEnumLabel :: Nt -> Label | |||||||||||||||
| Generate label for Nt + | |||||||||||||||
| defToEnumLabel :: Definition -> Label | |||||||||||||||
| Generate label for Definition + | |||||||||||||||
| defToEvalLabel :: Definition -> Label | |||||||||||||||
| Generate label for evaluation methods given a definition + | |||||||||||||||
| tTyToEvalLabel :: TermTy -> Label | |||||||||||||||
| Generate label for evaluation methods given a TermTy + | |||||||||||||||
| prodToEnumLabel :: Definition -> Prod -> Suffix -> Label | |||||||||||||||
| Generate label for Production + | |||||||||||||||
| childCallLabel :: Int -> String | |||||||||||||||
| Generates node child access label: + * 'n.child0()' or 'n.child1()' for left and right child + | |||||||||||||||
| Produced by Haddock version 0.8 |
| |||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| Description | |||||||||||||||||||||||||||||||
Author : Igor Boehm igor@bytelabs.org + Given operators and definitions extracted from the tree pattern matching + language specification, this module calculates all parameters which are + necessary in order to easily emit target code for the dynamic programming + stage of our code generator, namely the tiling phase. + | |||||||||||||||||||||||||||||||
| Synopsis | |||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| Types + | |||||||||||||||||||||||||||||||
| data Tiling | |||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| data Closure | |||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| type Arity = Int | |||||||||||||||||||||||||||||||
| type LinkSet = Set Operator | |||||||||||||||||||||||||||||||
| LinkSet. Set of operators having links + | |||||||||||||||||||||||||||||||
| type OperatorsPerArity = Map Arity (Set Operator) | |||||||||||||||||||||||||||||||
| OperatorsPerArity. Map of operators keyed by their arity + | |||||||||||||||||||||||||||||||
| type ProductionsPerArity = Map Arity [Prod] | |||||||||||||||||||||||||||||||
| ProductionsPerArity. Map of productions keyed by their arity + | |||||||||||||||||||||||||||||||
| Construction + | |||||||||||||||||||||||||||||||
| new :: [Operator] -> [Definition] -> Tiling | |||||||||||||||||||||||||||||||
| Constructs a Tiling from Operators and Definitions. This function unwraps definitions and extracts + all the necessary information in order to produce the Dynamic Programming + part of our code generator, namely the tiling. It starts off with an + initially almost empty Tiling and as the definitions are processed + as much information as possible is gathered to avoid repeated traversals + of the definition list. + | |||||||||||||||||||||||||||||||
| Functions + | |||||||||||||||||||||||||||||||
| getClosures :: Tiling -> [Closure] | |||||||||||||||||||||||||||||||
| hasClosures :: Tiling -> Bool | |||||||||||||||||||||||||||||||
| getProductionsPerArity :: Tiling -> ProductionsPerArity | |||||||||||||||||||||||||||||||
| getOperatorsPerArity :: Tiling -> OperatorsPerArity | |||||||||||||||||||||||||||||||
| getLinkSet :: Tiling -> LinkSet | |||||||||||||||||||||||||||||||
| getProdsForArity :: Tiling -> Arity -> [Prod] | |||||||||||||||||||||||||||||||
| closureGetFromLabel :: Closure -> Label | |||||||||||||||||||||||||||||||
| closureGetRuleLabel :: Closure -> Label | |||||||||||||||||||||||||||||||
| closureGetToLabel :: Closure -> Label | |||||||||||||||||||||||||||||||
| Produced by Haddock version 0.8 |
| ||||
| ||||
| Description | ||||
Author : Igor Boehm igor@bytelabs.org + This module creates all the necessary code given an AST of definitions + from the tree pattern matching language. The emit() function is the main + interface to the outside, abstracting away from the business of code generation. + | ||||
| Synopsis | ||||
| ||||
| Documentation | ||||
| emit :: Class -> Package -> NodeKind -> Include -> Declaration -> [Operator] -> [Definition] -> [Java] | ||||
| Generates all the code which is necessary in order to make our code generator work. + | ||||
| Produced by Haddock version 0.8 |
| ||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||
| Description | ||||||||||||||||||||||||||||||||||||||
Author : Igor Boehm igor@bytelabs.org + The main entry point of our code generator. In here we do several things, + namely: + * handles CLI args + * feeds the lexer and reacts to possible errors + * feeds the parser and reacts to possible errors + * feeds the code generator and emits its result to a file + | ||||||||||||||||||||||||||||||||||||||
| Synopsis | ||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||
| Documentation | ||||||||||||||||||||||||||||||||||||||
| main :: IO () | ||||||||||||||||||||||||||||||||||||||
| main. Read arguments and start code generator + | ||||||||||||||||||||||||||||||||||||||
| usageHeader :: String -> String | ||||||||||||||||||||||||||||||||||||||
| byeStr :: String -> IO a | ||||||||||||||||||||||||||||||||||||||
| bye :: IO a | ||||||||||||||||||||||||||||||||||||||
| showTokens :: [Token] -> IO a | ||||||||||||||||||||||||||||||||||||||
| die :: String -> IO a | ||||||||||||||||||||||||||||||||||||||
| dieCodeGen :: String -> IO a | ||||||||||||||||||||||||||||||||||||||
| data CLIFlags | ||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||
| constArgs :: [a] | ||||||||||||||||||||||||||||||||||||||
| argInfo :: [OptDescr CLIFlags] | ||||||||||||||||||||||||||||||||||||||
| getOutputClassName :: [CLIFlags] -> IO String | ||||||||||||||||||||||||||||||||||||||
| getOutputPackage :: [CLIFlags] -> IO String | ||||||||||||||||||||||||||||||||||||||
| getNodeKindType :: [CLIFlags] -> IO String | ||||||||||||||||||||||||||||||||||||||
| codeGen :: [String] -> IO () | ||||||||||||||||||||||||||||||||||||||
| Evaluate arguments and kick of scanner and parser + | ||||||||||||||||||||||||||||||||||||||
| runParse :: String -> Either (String, String) (Include, Declaration, [Operator], [Definition], String) | ||||||||||||||||||||||||||||||||||||||
| Runs the Lexer and Parser + | ||||||||||||||||||||||||||||||||||||||
| outputClass :: EmitClass a => [a] -> IO [()] | ||||||||||||||||||||||||||||||||||||||
| Output generated class into a file + | ||||||||||||||||||||||||||||||||||||||
| Produced by Haddock version 0.8 |
| |||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||
| Description | |||||||||||||||||||||||||||||||||||||||||||||
Author : Igor Boehm igor@bytelabs.org + Tree pattern matching language ALEX lexer specification. + | |||||||||||||||||||||||||||||||||||||||||||||
| Synopsis | |||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||
| Classes + | |||||||||||||||||||||||||||||||||||||||||||||
| data TokenClass | |||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||
| Types + | |||||||||||||||||||||||||||||||||||||||||||||
| data Token | |||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||
| Functions + | |||||||||||||||||||||||||||||||||||||||||||||
| scanner :: String -> Either String [Token] | |||||||||||||||||||||||||||||||||||||||||||||
| scanner. Tokenizes a String into an array of tokens + | |||||||||||||||||||||||||||||||||||||||||||||
| Produced by Haddock version 0.8 |
| |||||||||
| |||||||||
| |||||||||
| Description | |||||||||
Author : Igor Boehm igor@bytelabs.org + This module contains various error text generation functions. + | |||||||||
| Synopsis | |||||||||
| |||||||||
| Functions + | |||||||||
| parseErrDupBind :: String -> Elem -> Elem -> String | |||||||||
| parseErrDupBind. Produces error message when encountering + a duplicate binding. + | |||||||||
| parseErrRedefinition :: String -> Node -> Node -> String | |||||||||
| parseErrRedefinition. Produces error message upon the + redefinition of a Node. + | |||||||||
| parseErrTok :: Token -> String -> String | |||||||||
| parseErrTok. + | |||||||||
| parseErrElem :: Elem -> String -> String | |||||||||
| parseErrElem. Generic error message. + | |||||||||
| typeError :: Elem -> Int -> String -> String | |||||||||
| typeError. Produces error message upon type error. + | |||||||||
| Produced by Haddock version 0.8 |
| ||||||||||||||
| ||||||||||||||
| ||||||||||||||
| Description | ||||||||||||||
| The LR parser for our tree pattern matching grammar. It does some basic + semantic checking, e.g. duplicate bindings, type checking, etc. + | ||||||||||||||
| Synopsis | ||||||||||||||
| ||||||||||||||
| Types + | ||||||||||||||
| data ParseResult a | ||||||||||||||
| ||||||||||||||
| Functions + | ||||||||||||||
| Produced by Haddock version 0.8 |
| |||||
| |||||
| Description | |||||
Author : Igor Boehm igor@bytelabs.org + General utility functions. + | |||||
| Synopsis | |||||
| |||||
| Documentation | |||||
| stringToInt :: String -> Int | |||||
| stringToInt. Convert String to Int. + | |||||
| stringToUpper :: String -> String | |||||
| stringToUpper. + | |||||
| stringFoldr :: (String -> String -> String) -> [String] -> String | |||||
| stringFoldr. + | |||||
| Produced by Haddock version 0.8 |
| ||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||
| Index (A) | ||||||||||||||||||||||||||||
|
| ||||||||||||||||||
| ||||||||||||||||||
| Index (B) | ||||||||||||||||||
|
| ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| Index (C) | ||||||||||||||||||||||||||
|
| ||||||||||||||||||
| ||||||||||||||||||
| Index (D) | ||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Index (E) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Index (G) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||
| ||||||||||||||||||||
| Index (H) | ||||||||||||||||||||
| ||||||||||||||||||||
| ||||||||||||||||||||
| ||||||||||||||||||||
| Index (I) | ||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Index (J) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||
| ||||||||||||||||||
| Index (L) | ||||||||||||||||||
|
| ||||||||||||||||||
| ||||||||||||||||||
| Index (M) | ||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Index (N) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||
| Index (O) | ||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||
| Index (P) | ||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||
| ||||||||||||||||||
| Index (R) | ||||||||||||||||||
|
| ||||||||||||||||||||||||
| ||||||||||||||||||||||||
| Index (S) | ||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Index (T) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||
| ||||||||||||||||||
| Index (U) | ||||||||||||||||||
|
| ||||||||||||||||||
| Index | ||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Modules | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Produced by Haddock version 0.8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||