Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
This module describes the Relapse's abstract syntax tree.
It also contains some simple functions for the map of references that a Relapse grammar consists of.
Finally it also contains some very simple pattern functions.
Synopsis
- data Pattern
- data Grammar
- emptyRef :: Grammar
- union :: Grammar -> Grammar -> Grammar
- newRef :: String -> Pattern -> Grammar
- reverseLookupRef :: Pattern -> Grammar -> Maybe String
- lookupRef :: Grammar -> String -> Either String Pattern
- hasRecursion :: Grammar -> Either String Bool
- listRefs :: Grammar -> [String]
- nullable :: Grammar -> Pattern -> Either String Bool
Documentation
Pattern recursively describes a Relapse Pattern.
Refs is a map from reference name to pattern and describes a relapse grammar.
newRef :: String -> Pattern -> Grammar Source #
newRef returns a new reference map given a single pattern and its reference name.
reverseLookupRef :: Pattern -> Grammar -> Maybe String Source #
reverseLookupRef returns the reference name for a given pattern.
lookupRef :: Grammar -> String -> Either String Pattern Source #
lookupRef looks up a pattern in the reference map, given a reference name.