typed-peg-0.4.0.0: src/PEG.hs
-- | Type-safe PEG (Parsing Expression Grammar) parser combinators.
--
-- Grammar non-terminals are checked at the type level against an environment
-- that binds each rule's name to the type it returns, so a reference to a
-- rule that does not exist, or a use of one at the wrong type, is a type
-- error. Left recursion, a repetition that cannot consume input, an
-- undefined non-terminal and a duplicate rule are rejected by the
-- quasi-quoter when the grammar is spliced; see "PEG.Grammar" for exactly
-- what is checked where.
--
-- == Quick start
--
-- @
-- import PEG
-- import PEG.QQ (pegGrammar)
-- @
--
-- 1. Write the grammar with the 'PEG.QQ.pegGrammar' quasi-quoter, giving each
-- rule its result type. It declares the grammar's key type — one
-- constructor per rule, see "PEG.Key" — the grammar and its signature.
-- 2. Run the grammar on a 'String' with 'parse' or 'parseWith'.
--
-- The rules can also be named by a type-level list declared by hand — see
-- 'PEG.Type.Env' — and built with 'PEG.QQ.pegRules' or the combinators in
-- "PEG.Syntax", as a @'Grammar' s ('InEnv' env) a@. That stays supported; it
-- is more to write, and compiling it costs more than linearly in the number of
-- rules.
--
-- See the @examples/@ directory for complete working grammars.
module PEG
( module PEG.CharSet
, module PEG.Stream
, module PEG.Type
, module PEG.TyLevel
, module PEG.Member
, module PEG.Key
, module PEG.Indent
, module PEG.Syntax
, module PEG.Grammar
, module PEG.Parse
) where
import PEG.CharSet
import PEG.Grammar
import PEG.Stream
import PEG.Indent
import PEG.Key
import PEG.Member
import PEG.Parse
import PEG.Syntax
import PEG.TyLevel
import PEG.Type