parsley-core-2.3.0.0: A fast parser combinator library backed by Typed Template Haskell
LicenseBSD-3-Clause
MaintainerJamie Willis
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Parsley.Internal.Backend.Machine.Types

Description

This module contains the monadic machinery used in the evaluation of a parser machine. It also rexports parts of Base and Statics for compatiblity with the ghc 8.6+ backend, which shares common code for LetRecBuilder.hs.

Since: 1.4.0.0

Synopsis

Documentation

newtype Machine s o xs n r a Source #

Wraps up the MachineMonad type so that it can serve as the carrier of cata4.

Since: 1.4.0.0

Constructors

Machine 

Fields

type MachineMonad s o xs n r a = Reader (Ctx s o a) (Γ s o xs n r a -> Code (ST s (Maybe a))) Source #

The monad stack used to evaluate a parser machine, see run.

Since: 1.4.0.0

run Source #

Arguments

:: Machine s o xs n r a

The action that will generate the final code.

-> Γ s o xs n r a

The informaton that is threaded through the parsing machinery, which appears in some form in the generated code.

-> Ctx s o a

Static information used in the code generation process, but not in the generated code.

-> Code (ST s (Maybe a))

The code that represents this parser (after having been given an input).

Used to execute the evaluator for a parser machine, resulting in the final code to be returned back to the User API.

Since: 1.4.0.0

Compatibility Re-exports

type family Func (rs :: [Type]) s o a x where ... Source #

A Func is a Subroutine# augmented with extra arguments with which to handle over the required free-registers of the parser. These are registers that are not created by the parser, but are used to execute it.

Since: 1.4.0.0

Equations

Func '[] s o a x = Subroutine# s o a x 
Func (r ': rs) s o a x = STRef s r -> Func rs s o a x 

data QSubroutine s o a x Source #

Wraps a StaFunc with its free registers, which are kept existential.

Since: 1.4.0.0

qSubroutine :: forall s o a x rs. DynFunc rs s o a x -> Regs rs -> Metadata -> QSubroutine s o a x Source #

Converts a DynFunc that relies on zero or more free registers into a QSubroutine, where the registers are existentially bounds to the function.

Since: 1.5.0.0