katydid-0.4.0.2: A haskell implementation of Katydid

Safe HaskellSafe
LanguageHaskell2010

Data.Katydid.Relapse.Ast

Description

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

Documentation

data Grammar Source #

Refs is a map from reference name to pattern and describes a relapse grammar.

Instances
Eq Grammar Source # 
Instance details

Defined in Data.Katydid.Relapse.Ast

Methods

(==) :: Grammar -> Grammar -> Bool #

(/=) :: Grammar -> Grammar -> Bool #

Show Grammar Source # 
Instance details

Defined in Data.Katydid.Relapse.Ast

emptyRef :: Grammar Source #

emptyRef returns an empty reference map.

union :: Grammar -> Grammar -> Grammar Source #

union returns the union of two reference maps.

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.

hasRecursion :: Grammar -> Either String Bool Source #

hasRecursion returns whether an relapse grammar has any recursion, starting from the "main" reference.

listRefs :: Grammar -> [String] Source #

listRefs returns the list of reference names.

nullable :: Grammar -> Pattern -> Either String Bool Source #

The nullable function returns whether a pattern is nullable. This means that the pattern matches the empty string.