LangToGroup-0.1.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

GrammarType

Description

This module represents types of formal grammar.

In the moment we use it to represent a context-free grammar, conjunctive grammar, boolean grammar.

Synopsis

Documentation

newtype Terminal Source #

Terminal is a type that represents terminal in the formal grammar Grammar.

Constructors

Terminal 

Instances

Instances details
Eq Terminal Source # 
Instance details

Defined in GrammarType

Ord Terminal Source # 
Instance details

Defined in GrammarType

Show Terminal Source # 
Instance details

Defined in GrammarType

newtype Nonterminal Source #

Nonterminal is a type that represents nonterminal in the formal grammar Grammar.

Constructors

Nonterminal 

data Symbol Source #

Symbol represents symbol that can be appear in right part of the Relation.

T is for Terminal.

N is for Nonterminal.

And Eps is for empty symbol, epsilon.

Constructors

T Terminal 
N Nonterminal 
Eps 

Instances

Instances details
Eq Symbol Source # 
Instance details

Defined in GrammarType

Methods

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

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

Ord Symbol Source # 
Instance details

Defined in GrammarType

Show Symbol Source # 
Instance details

Defined in GrammarType

data Conj Source #

Conj is helper type for representing the right part of a relation in a boolean grammar

Constructors

PosConj 

Fields

NegConj 

Fields

Instances

Instances details
Eq Conj Source # 
Instance details

Defined in GrammarType

Methods

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

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

Ord Conj Source # 
Instance details

Defined in GrammarType

Methods

compare :: Conj -> Conj -> Ordering #

(<) :: Conj -> Conj -> Bool #

(<=) :: Conj -> Conj -> Bool #

(>) :: Conj -> Conj -> Bool #

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

max :: Conj -> Conj -> Conj #

min :: Conj -> Conj -> Conj #

Show Conj Source # 
Instance details

Defined in GrammarType

Methods

showsPrec :: Int -> Conj -> ShowS #

show :: Conj -> String #

showList :: [Conj] -> ShowS #

type StartSymbol = Nonterminal Source #

This type is synonym Nonterminal and used in order to separate StartSymbol from normal Nonterminal.

data Relation Source #

Relation is a rule of Grammar. First constructor is for working only with CFG grammars Second constructor is for working with Boolean or Conjunctive grammars, though it might be used for defining grammars too (right part of CFG relation is one PosConj in right part of boolean relation)

Instances

Instances details
Eq Relation Source # 
Instance details

Defined in GrammarType

Ord Relation Source # 
Instance details

Defined in GrammarType

Show Relation Source # 
Instance details

Defined in GrammarType

data GrammarType Source #

This type we using to classify grammars.

Constructors

CFG 
Conjunctive 
Boolean 

newtype Grammar Source #

This type we using to represent a formal grammar.

Instances

Instances details
Eq Grammar Source # 
Instance details

Defined in GrammarType

Methods

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

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

Ord Grammar Source # 
Instance details

Defined in GrammarType

Show Grammar Source # 
Instance details

Defined in GrammarType

ShowInfo Grammar Source # 
Instance details

Defined in ShowInfo