Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
The result of a generator.
Ended (ST s [(a, [t])]) | The generator ended. |
Generated (ST s [(a, [t])]) (ST s (Result s t a)) | The generator produced a number of |
generator :: (forall r. Grammar r (Prod r e t a)) -> [t] -> Generator t a Source #
Create a language generator for given grammar and list of allowed tokens.
language :: Generator t a -> [(a, [t])] Source #
Run a generator, returning all members of the language.
The members are returned as parse results paired with the list of tokens used to produce the result. The elements of the returned list of results are sorted by their length in ascending order. If there are multiple results of the same length they are returned in an unspecified order.
upTo :: Int -> Generator t a -> [(a, [t])] Source #
upTo n gen
runs the generator gen
, returning all members of the
language that are of length less than or equal to n
.
The members are returned as parse results paired with the list of tokens used to produce the result. The elements of the returned list of results are sorted by their length in ascending order. If there are multiple results of the same length they are returned in an unspecified order.
exactly :: Int -> Generator t a -> [(a, [t])] Source #
exactly n gen
runs the generator gen
, returning all members of the
language that are of length equal to n
.
The members are returned as parse results paired with the list of tokens used to produce the result. If there are multiple results they are returned in an unspecified order.