-- | A common API for BNF-based grammars, specifying context-free languages

module Hydra.Grammar where

import qualified Hydra.Core as Core
import Data.Int
import Data.List as L
import Data.Map as M
import Data.Set as S

-- | A constant pattern
newtype Constant = 
  Constant {
    Constant -> String
unConstant :: String}
  deriving (Constant -> Constant -> Bool
(Constant -> Constant -> Bool)
-> (Constant -> Constant -> Bool) -> Eq Constant
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Constant -> Constant -> Bool
== :: Constant -> Constant -> Bool
$c/= :: Constant -> Constant -> Bool
/= :: Constant -> Constant -> Bool
Eq, Eq Constant
Eq Constant =>
(Constant -> Constant -> Ordering)
-> (Constant -> Constant -> Bool)
-> (Constant -> Constant -> Bool)
-> (Constant -> Constant -> Bool)
-> (Constant -> Constant -> Bool)
-> (Constant -> Constant -> Constant)
-> (Constant -> Constant -> Constant)
-> Ord Constant
Constant -> Constant -> Bool
Constant -> Constant -> Ordering
Constant -> Constant -> Constant
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Constant -> Constant -> Ordering
compare :: Constant -> Constant -> Ordering
$c< :: Constant -> Constant -> Bool
< :: Constant -> Constant -> Bool
$c<= :: Constant -> Constant -> Bool
<= :: Constant -> Constant -> Bool
$c> :: Constant -> Constant -> Bool
> :: Constant -> Constant -> Bool
$c>= :: Constant -> Constant -> Bool
>= :: Constant -> Constant -> Bool
$cmax :: Constant -> Constant -> Constant
max :: Constant -> Constant -> Constant
$cmin :: Constant -> Constant -> Constant
min :: Constant -> Constant -> Constant
Ord, ReadPrec [Constant]
ReadPrec Constant
Int -> ReadS Constant
ReadS [Constant]
(Int -> ReadS Constant)
-> ReadS [Constant]
-> ReadPrec Constant
-> ReadPrec [Constant]
-> Read Constant
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Constant
readsPrec :: Int -> ReadS Constant
$creadList :: ReadS [Constant]
readList :: ReadS [Constant]
$creadPrec :: ReadPrec Constant
readPrec :: ReadPrec Constant
$creadListPrec :: ReadPrec [Constant]
readListPrec :: ReadPrec [Constant]
Read, Int -> Constant -> String -> String
[Constant] -> String -> String
Constant -> String
(Int -> Constant -> String -> String)
-> (Constant -> String)
-> ([Constant] -> String -> String)
-> Show Constant
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> Constant -> String -> String
showsPrec :: Int -> Constant -> String -> String
$cshow :: Constant -> String
show :: Constant -> String
$cshowList :: [Constant] -> String -> String
showList :: [Constant] -> String -> String
Show)

_Constant :: Name
_Constant = (String -> Name
Core.Name String
"hydra/grammar.Constant")

-- | An enhanced Backus-Naur form (BNF) grammar
newtype Grammar = 
  Grammar {
    Grammar -> [Production]
unGrammar :: [Production]}
  deriving (Grammar -> Grammar -> Bool
(Grammar -> Grammar -> Bool)
-> (Grammar -> Grammar -> Bool) -> Eq Grammar
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Grammar -> Grammar -> Bool
== :: Grammar -> Grammar -> Bool
$c/= :: Grammar -> Grammar -> Bool
/= :: Grammar -> Grammar -> Bool
Eq, Eq Grammar
Eq Grammar =>
(Grammar -> Grammar -> Ordering)
-> (Grammar -> Grammar -> Bool)
-> (Grammar -> Grammar -> Bool)
-> (Grammar -> Grammar -> Bool)
-> (Grammar -> Grammar -> Bool)
-> (Grammar -> Grammar -> Grammar)
-> (Grammar -> Grammar -> Grammar)
-> Ord Grammar
Grammar -> Grammar -> Bool
Grammar -> Grammar -> Ordering
Grammar -> Grammar -> Grammar
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Grammar -> Grammar -> Ordering
compare :: Grammar -> Grammar -> Ordering
$c< :: Grammar -> Grammar -> Bool
< :: Grammar -> Grammar -> Bool
$c<= :: Grammar -> Grammar -> Bool
<= :: Grammar -> Grammar -> Bool
$c> :: Grammar -> Grammar -> Bool
> :: Grammar -> Grammar -> Bool
$c>= :: Grammar -> Grammar -> Bool
>= :: Grammar -> Grammar -> Bool
$cmax :: Grammar -> Grammar -> Grammar
max :: Grammar -> Grammar -> Grammar
$cmin :: Grammar -> Grammar -> Grammar
min :: Grammar -> Grammar -> Grammar
Ord, ReadPrec [Grammar]
ReadPrec Grammar
Int -> ReadS Grammar
ReadS [Grammar]
(Int -> ReadS Grammar)
-> ReadS [Grammar]
-> ReadPrec Grammar
-> ReadPrec [Grammar]
-> Read Grammar
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Grammar
readsPrec :: Int -> ReadS Grammar
$creadList :: ReadS [Grammar]
readList :: ReadS [Grammar]
$creadPrec :: ReadPrec Grammar
readPrec :: ReadPrec Grammar
$creadListPrec :: ReadPrec [Grammar]
readListPrec :: ReadPrec [Grammar]
Read, Int -> Grammar -> String -> String
[Grammar] -> String -> String
Grammar -> String
(Int -> Grammar -> String -> String)
-> (Grammar -> String)
-> ([Grammar] -> String -> String)
-> Show Grammar
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> Grammar -> String -> String
showsPrec :: Int -> Grammar -> String -> String
$cshow :: Grammar -> String
show :: Grammar -> String
$cshowList :: [Grammar] -> String -> String
showList :: [Grammar] -> String -> String
Show)

_Grammar :: Name
_Grammar = (String -> Name
Core.Name String
"hydra/grammar.Grammar")

-- | A name for a pattern
newtype Label = 
  Label {
    Label -> String
unLabel :: String}
  deriving (Label -> Label -> Bool
(Label -> Label -> Bool) -> (Label -> Label -> Bool) -> Eq Label
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Label -> Label -> Bool
== :: Label -> Label -> Bool
$c/= :: Label -> Label -> Bool
/= :: Label -> Label -> Bool
Eq, Eq Label
Eq Label =>
(Label -> Label -> Ordering)
-> (Label -> Label -> Bool)
-> (Label -> Label -> Bool)
-> (Label -> Label -> Bool)
-> (Label -> Label -> Bool)
-> (Label -> Label -> Label)
-> (Label -> Label -> Label)
-> Ord Label
Label -> Label -> Bool
Label -> Label -> Ordering
Label -> Label -> Label
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Label -> Label -> Ordering
compare :: Label -> Label -> Ordering
$c< :: Label -> Label -> Bool
< :: Label -> Label -> Bool
$c<= :: Label -> Label -> Bool
<= :: Label -> Label -> Bool
$c> :: Label -> Label -> Bool
> :: Label -> Label -> Bool
$c>= :: Label -> Label -> Bool
>= :: Label -> Label -> Bool
$cmax :: Label -> Label -> Label
max :: Label -> Label -> Label
$cmin :: Label -> Label -> Label
min :: Label -> Label -> Label
Ord, ReadPrec [Label]
ReadPrec Label
Int -> ReadS Label
ReadS [Label]
(Int -> ReadS Label)
-> ReadS [Label]
-> ReadPrec Label
-> ReadPrec [Label]
-> Read Label
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Label
readsPrec :: Int -> ReadS Label
$creadList :: ReadS [Label]
readList :: ReadS [Label]
$creadPrec :: ReadPrec Label
readPrec :: ReadPrec Label
$creadListPrec :: ReadPrec [Label]
readListPrec :: ReadPrec [Label]
Read, Int -> Label -> String -> String
[Label] -> String -> String
Label -> String
(Int -> Label -> String -> String)
-> (Label -> String) -> ([Label] -> String -> String) -> Show Label
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> Label -> String -> String
showsPrec :: Int -> Label -> String -> String
$cshow :: Label -> String
show :: Label -> String
$cshowList :: [Label] -> String -> String
showList :: [Label] -> String -> String
Show)

_Label :: Name
_Label = (String -> Name
Core.Name String
"hydra/grammar.Label")

-- | A pattern together with a name (label)
data LabeledPattern = 
  LabeledPattern {
    LabeledPattern -> Label
labeledPatternLabel :: Label,
    LabeledPattern -> Pattern
labeledPatternPattern :: Pattern}
  deriving (LabeledPattern -> LabeledPattern -> Bool
(LabeledPattern -> LabeledPattern -> Bool)
-> (LabeledPattern -> LabeledPattern -> Bool) -> Eq LabeledPattern
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LabeledPattern -> LabeledPattern -> Bool
== :: LabeledPattern -> LabeledPattern -> Bool
$c/= :: LabeledPattern -> LabeledPattern -> Bool
/= :: LabeledPattern -> LabeledPattern -> Bool
Eq, Eq LabeledPattern
Eq LabeledPattern =>
(LabeledPattern -> LabeledPattern -> Ordering)
-> (LabeledPattern -> LabeledPattern -> Bool)
-> (LabeledPattern -> LabeledPattern -> Bool)
-> (LabeledPattern -> LabeledPattern -> Bool)
-> (LabeledPattern -> LabeledPattern -> Bool)
-> (LabeledPattern -> LabeledPattern -> LabeledPattern)
-> (LabeledPattern -> LabeledPattern -> LabeledPattern)
-> Ord LabeledPattern
LabeledPattern -> LabeledPattern -> Bool
LabeledPattern -> LabeledPattern -> Ordering
LabeledPattern -> LabeledPattern -> LabeledPattern
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: LabeledPattern -> LabeledPattern -> Ordering
compare :: LabeledPattern -> LabeledPattern -> Ordering
$c< :: LabeledPattern -> LabeledPattern -> Bool
< :: LabeledPattern -> LabeledPattern -> Bool
$c<= :: LabeledPattern -> LabeledPattern -> Bool
<= :: LabeledPattern -> LabeledPattern -> Bool
$c> :: LabeledPattern -> LabeledPattern -> Bool
> :: LabeledPattern -> LabeledPattern -> Bool
$c>= :: LabeledPattern -> LabeledPattern -> Bool
>= :: LabeledPattern -> LabeledPattern -> Bool
$cmax :: LabeledPattern -> LabeledPattern -> LabeledPattern
max :: LabeledPattern -> LabeledPattern -> LabeledPattern
$cmin :: LabeledPattern -> LabeledPattern -> LabeledPattern
min :: LabeledPattern -> LabeledPattern -> LabeledPattern
Ord, ReadPrec [LabeledPattern]
ReadPrec LabeledPattern
Int -> ReadS LabeledPattern
ReadS [LabeledPattern]
(Int -> ReadS LabeledPattern)
-> ReadS [LabeledPattern]
-> ReadPrec LabeledPattern
-> ReadPrec [LabeledPattern]
-> Read LabeledPattern
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS LabeledPattern
readsPrec :: Int -> ReadS LabeledPattern
$creadList :: ReadS [LabeledPattern]
readList :: ReadS [LabeledPattern]
$creadPrec :: ReadPrec LabeledPattern
readPrec :: ReadPrec LabeledPattern
$creadListPrec :: ReadPrec [LabeledPattern]
readListPrec :: ReadPrec [LabeledPattern]
Read, Int -> LabeledPattern -> String -> String
[LabeledPattern] -> String -> String
LabeledPattern -> String
(Int -> LabeledPattern -> String -> String)
-> (LabeledPattern -> String)
-> ([LabeledPattern] -> String -> String)
-> Show LabeledPattern
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> LabeledPattern -> String -> String
showsPrec :: Int -> LabeledPattern -> String -> String
$cshow :: LabeledPattern -> String
show :: LabeledPattern -> String
$cshowList :: [LabeledPattern] -> String -> String
showList :: [LabeledPattern] -> String -> String
Show)

_LabeledPattern :: Name
_LabeledPattern = (String -> Name
Core.Name String
"hydra/grammar.LabeledPattern")

_LabeledPattern_label :: Name
_LabeledPattern_label = (String -> Name
Core.Name String
"label")

_LabeledPattern_pattern :: Name
_LabeledPattern_pattern = (String -> Name
Core.Name String
"pattern")

-- | A pattern which matches valid expressions in the language
data Pattern = 
  PatternNil  |
  PatternIgnored Pattern |
  PatternLabeled LabeledPattern |
  PatternConstant Constant |
  PatternRegex Regex |
  PatternNonterminal Symbol |
  PatternSequence [Pattern] |
  PatternAlternatives [Pattern] |
  PatternOption Pattern |
  PatternStar Pattern |
  PatternPlus Pattern
  deriving (Pattern -> Pattern -> Bool
(Pattern -> Pattern -> Bool)
-> (Pattern -> Pattern -> Bool) -> Eq Pattern
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Pattern -> Pattern -> Bool
== :: Pattern -> Pattern -> Bool
$c/= :: Pattern -> Pattern -> Bool
/= :: Pattern -> Pattern -> Bool
Eq, Eq Pattern
Eq Pattern =>
(Pattern -> Pattern -> Ordering)
-> (Pattern -> Pattern -> Bool)
-> (Pattern -> Pattern -> Bool)
-> (Pattern -> Pattern -> Bool)
-> (Pattern -> Pattern -> Bool)
-> (Pattern -> Pattern -> Pattern)
-> (Pattern -> Pattern -> Pattern)
-> Ord Pattern
Pattern -> Pattern -> Bool
Pattern -> Pattern -> Ordering
Pattern -> Pattern -> Pattern
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Pattern -> Pattern -> Ordering
compare :: Pattern -> Pattern -> Ordering
$c< :: Pattern -> Pattern -> Bool
< :: Pattern -> Pattern -> Bool
$c<= :: Pattern -> Pattern -> Bool
<= :: Pattern -> Pattern -> Bool
$c> :: Pattern -> Pattern -> Bool
> :: Pattern -> Pattern -> Bool
$c>= :: Pattern -> Pattern -> Bool
>= :: Pattern -> Pattern -> Bool
$cmax :: Pattern -> Pattern -> Pattern
max :: Pattern -> Pattern -> Pattern
$cmin :: Pattern -> Pattern -> Pattern
min :: Pattern -> Pattern -> Pattern
Ord, ReadPrec [Pattern]
ReadPrec Pattern
Int -> ReadS Pattern
ReadS [Pattern]
(Int -> ReadS Pattern)
-> ReadS [Pattern]
-> ReadPrec Pattern
-> ReadPrec [Pattern]
-> Read Pattern
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Pattern
readsPrec :: Int -> ReadS Pattern
$creadList :: ReadS [Pattern]
readList :: ReadS [Pattern]
$creadPrec :: ReadPrec Pattern
readPrec :: ReadPrec Pattern
$creadListPrec :: ReadPrec [Pattern]
readListPrec :: ReadPrec [Pattern]
Read, Int -> Pattern -> String -> String
[Pattern] -> String -> String
Pattern -> String
(Int -> Pattern -> String -> String)
-> (Pattern -> String)
-> ([Pattern] -> String -> String)
-> Show Pattern
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> Pattern -> String -> String
showsPrec :: Int -> Pattern -> String -> String
$cshow :: Pattern -> String
show :: Pattern -> String
$cshowList :: [Pattern] -> String -> String
showList :: [Pattern] -> String -> String
Show)

_Pattern :: Name
_Pattern = (String -> Name
Core.Name String
"hydra/grammar.Pattern")

_Pattern_nil :: Name
_Pattern_nil = (String -> Name
Core.Name String
"nil")

_Pattern_ignored :: Name
_Pattern_ignored = (String -> Name
Core.Name String
"ignored")

_Pattern_labeled :: Name
_Pattern_labeled = (String -> Name
Core.Name String
"labeled")

_Pattern_constant :: Name
_Pattern_constant = (String -> Name
Core.Name String
"constant")

_Pattern_regex :: Name
_Pattern_regex = (String -> Name
Core.Name String
"regex")

_Pattern_nonterminal :: Name
_Pattern_nonterminal = (String -> Name
Core.Name String
"nonterminal")

_Pattern_sequence :: Name
_Pattern_sequence = (String -> Name
Core.Name String
"sequence")

_Pattern_alternatives :: Name
_Pattern_alternatives = (String -> Name
Core.Name String
"alternatives")

_Pattern_option :: Name
_Pattern_option = (String -> Name
Core.Name String
"option")

_Pattern_star :: Name
_Pattern_star = (String -> Name
Core.Name String
"star")

_Pattern_plus :: Name
_Pattern_plus = (String -> Name
Core.Name String
"plus")

-- | A BNF production
data Production = 
  Production {
    Production -> Symbol
productionSymbol :: Symbol,
    Production -> Pattern
productionPattern :: Pattern}
  deriving (Production -> Production -> Bool
(Production -> Production -> Bool)
-> (Production -> Production -> Bool) -> Eq Production
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Production -> Production -> Bool
== :: Production -> Production -> Bool
$c/= :: Production -> Production -> Bool
/= :: Production -> Production -> Bool
Eq, Eq Production
Eq Production =>
(Production -> Production -> Ordering)
-> (Production -> Production -> Bool)
-> (Production -> Production -> Bool)
-> (Production -> Production -> Bool)
-> (Production -> Production -> Bool)
-> (Production -> Production -> Production)
-> (Production -> Production -> Production)
-> Ord Production
Production -> Production -> Bool
Production -> Production -> Ordering
Production -> Production -> Production
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Production -> Production -> Ordering
compare :: Production -> Production -> Ordering
$c< :: Production -> Production -> Bool
< :: Production -> Production -> Bool
$c<= :: Production -> Production -> Bool
<= :: Production -> Production -> Bool
$c> :: Production -> Production -> Bool
> :: Production -> Production -> Bool
$c>= :: Production -> Production -> Bool
>= :: Production -> Production -> Bool
$cmax :: Production -> Production -> Production
max :: Production -> Production -> Production
$cmin :: Production -> Production -> Production
min :: Production -> Production -> Production
Ord, ReadPrec [Production]
ReadPrec Production
Int -> ReadS Production
ReadS [Production]
(Int -> ReadS Production)
-> ReadS [Production]
-> ReadPrec Production
-> ReadPrec [Production]
-> Read Production
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Production
readsPrec :: Int -> ReadS Production
$creadList :: ReadS [Production]
readList :: ReadS [Production]
$creadPrec :: ReadPrec Production
readPrec :: ReadPrec Production
$creadListPrec :: ReadPrec [Production]
readListPrec :: ReadPrec [Production]
Read, Int -> Production -> String -> String
[Production] -> String -> String
Production -> String
(Int -> Production -> String -> String)
-> (Production -> String)
-> ([Production] -> String -> String)
-> Show Production
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> Production -> String -> String
showsPrec :: Int -> Production -> String -> String
$cshow :: Production -> String
show :: Production -> String
$cshowList :: [Production] -> String -> String
showList :: [Production] -> String -> String
Show)

_Production :: Name
_Production = (String -> Name
Core.Name String
"hydra/grammar.Production")

_Production_symbol :: Name
_Production_symbol = (String -> Name
Core.Name String
"symbol")

_Production_pattern :: Name
_Production_pattern = (String -> Name
Core.Name String
"pattern")

-- | A regular expression
newtype Regex = 
  Regex {
    Regex -> String
unRegex :: String}
  deriving (Regex -> Regex -> Bool
(Regex -> Regex -> Bool) -> (Regex -> Regex -> Bool) -> Eq Regex
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Regex -> Regex -> Bool
== :: Regex -> Regex -> Bool
$c/= :: Regex -> Regex -> Bool
/= :: Regex -> Regex -> Bool
Eq, Eq Regex
Eq Regex =>
(Regex -> Regex -> Ordering)
-> (Regex -> Regex -> Bool)
-> (Regex -> Regex -> Bool)
-> (Regex -> Regex -> Bool)
-> (Regex -> Regex -> Bool)
-> (Regex -> Regex -> Regex)
-> (Regex -> Regex -> Regex)
-> Ord Regex
Regex -> Regex -> Bool
Regex -> Regex -> Ordering
Regex -> Regex -> Regex
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Regex -> Regex -> Ordering
compare :: Regex -> Regex -> Ordering
$c< :: Regex -> Regex -> Bool
< :: Regex -> Regex -> Bool
$c<= :: Regex -> Regex -> Bool
<= :: Regex -> Regex -> Bool
$c> :: Regex -> Regex -> Bool
> :: Regex -> Regex -> Bool
$c>= :: Regex -> Regex -> Bool
>= :: Regex -> Regex -> Bool
$cmax :: Regex -> Regex -> Regex
max :: Regex -> Regex -> Regex
$cmin :: Regex -> Regex -> Regex
min :: Regex -> Regex -> Regex
Ord, ReadPrec [Regex]
ReadPrec Regex
Int -> ReadS Regex
ReadS [Regex]
(Int -> ReadS Regex)
-> ReadS [Regex]
-> ReadPrec Regex
-> ReadPrec [Regex]
-> Read Regex
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Regex
readsPrec :: Int -> ReadS Regex
$creadList :: ReadS [Regex]
readList :: ReadS [Regex]
$creadPrec :: ReadPrec Regex
readPrec :: ReadPrec Regex
$creadListPrec :: ReadPrec [Regex]
readListPrec :: ReadPrec [Regex]
Read, Int -> Regex -> String -> String
[Regex] -> String -> String
Regex -> String
(Int -> Regex -> String -> String)
-> (Regex -> String) -> ([Regex] -> String -> String) -> Show Regex
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> Regex -> String -> String
showsPrec :: Int -> Regex -> String -> String
$cshow :: Regex -> String
show :: Regex -> String
$cshowList :: [Regex] -> String -> String
showList :: [Regex] -> String -> String
Show)

_Regex :: Name
_Regex = (String -> Name
Core.Name String
"hydra/grammar.Regex")

-- | A nonterminal symbol
newtype Symbol = 
  Symbol {
    Symbol -> String
unSymbol :: String}
  deriving (Symbol -> Symbol -> Bool
(Symbol -> Symbol -> Bool)
-> (Symbol -> Symbol -> Bool) -> Eq Symbol
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Symbol -> Symbol -> Bool
== :: Symbol -> Symbol -> Bool
$c/= :: Symbol -> Symbol -> Bool
/= :: Symbol -> Symbol -> Bool
Eq, Eq Symbol
Eq Symbol =>
(Symbol -> Symbol -> Ordering)
-> (Symbol -> Symbol -> Bool)
-> (Symbol -> Symbol -> Bool)
-> (Symbol -> Symbol -> Bool)
-> (Symbol -> Symbol -> Bool)
-> (Symbol -> Symbol -> Symbol)
-> (Symbol -> Symbol -> Symbol)
-> Ord Symbol
Symbol -> Symbol -> Bool
Symbol -> Symbol -> Ordering
Symbol -> Symbol -> Symbol
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Symbol -> Symbol -> Ordering
compare :: Symbol -> Symbol -> Ordering
$c< :: Symbol -> Symbol -> Bool
< :: Symbol -> Symbol -> Bool
$c<= :: Symbol -> Symbol -> Bool
<= :: Symbol -> Symbol -> Bool
$c> :: Symbol -> Symbol -> Bool
> :: Symbol -> Symbol -> Bool
$c>= :: Symbol -> Symbol -> Bool
>= :: Symbol -> Symbol -> Bool
$cmax :: Symbol -> Symbol -> Symbol
max :: Symbol -> Symbol -> Symbol
$cmin :: Symbol -> Symbol -> Symbol
min :: Symbol -> Symbol -> Symbol
Ord, ReadPrec [Symbol]
ReadPrec Symbol
Int -> ReadS Symbol
ReadS [Symbol]
(Int -> ReadS Symbol)
-> ReadS [Symbol]
-> ReadPrec Symbol
-> ReadPrec [Symbol]
-> Read Symbol
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Symbol
readsPrec :: Int -> ReadS Symbol
$creadList :: ReadS [Symbol]
readList :: ReadS [Symbol]
$creadPrec :: ReadPrec Symbol
readPrec :: ReadPrec Symbol
$creadListPrec :: ReadPrec [Symbol]
readListPrec :: ReadPrec [Symbol]
Read, Int -> Symbol -> String -> String
[Symbol] -> String -> String
Symbol -> String
(Int -> Symbol -> String -> String)
-> (Symbol -> String)
-> ([Symbol] -> String -> String)
-> Show Symbol
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> Symbol -> String -> String
showsPrec :: Int -> Symbol -> String -> String
$cshow :: Symbol -> String
show :: Symbol -> String
$cshowList :: [Symbol] -> String -> String
showList :: [Symbol] -> String -> String
Show)

_Symbol :: Name
_Symbol = (String -> Name
Core.Name String
"hydra/grammar.Symbol")