parser241-0.1.0.2: An interface to create production rules using augmented grammars

Safe HaskellNone
LanguageHaskell2010

Parser.ProductRule.Internal.Maker

Synopsis

Documentation

newtype Maker' a x Source

Constructors

Maker 

Fields

unMaker :: (Symbol a, [[Symbol a]])
 

type Maker a = Maker' a () Source

maker :: (Symbol a, [[Symbol a]]) -> Maker a Source

(--->) :: FromMaker m => Ord a => Symbol a -> a -> m a () Source

Use ---> iff the left side is the Start symbol and the first symbol on the right side is an user-defined symbol.

Only one symbol is allowed on the left hand side.

table :: [ProductRule MySym]
table = productRules $ do
   Start ---> A & B ...
           ...

(-->) :: FromMaker m => Ord a => a -> a -> m a () Source

Use --> iff both the left side and the first symbol on the right side are user-defined symbols.

| Only one symbol is allowed on the left hand side.

| Use & to concatenate two user-defined symbols.

table :: [ProductRule MySym]
table = productRules $ do
   Start ---> ...
           ...
      ; A --> C'
           |/ Null
           ...

(&) :: FromMaker m => Maker a -> a -> m a () Source

Use & to concatenate two user-defined symbols.

table :: [ProductRule MySym]
table = productRules $ do
   Start >>> Null & C'
          |> ...

(|>) :: FromMaker m => Maker a -> a -> m a () Source

Use |> to represent "or" when the left hand side can produce two different expressions, and the right side in a user-defined type.

table :: [ProductRule MySym]
table = productRules $ do
   Start ---> ...
           ...
           |> C'

(|/) :: FromMaker m => Maker a -> Symbol a -> m a () Source

Use |/ iff the right hand side is the Null symbol.

table :: [ProductRule MySym]
table = productRules $ do
   Start ---> C'
           |/ Null
           |> ...

(>>>) :: FromMaker m => Symbol a -> Symbol a -> m a () Source

Use >>> iff the left side is Start and the first symbol on the right side is Null.

table :: [ProductRule MySym]
table = productRules $ do
   Start >>> Null
          |> C'
          ...

class FromMaker m where Source

Methods

fromMaker :: Maker a -> m a () Source