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

Parsley.Internal.Backend.Machine.LetBindings

Description

Definitions for various encapsulating datatypes for machines, and defining free registers.

Since: 1.0.0.0

Synopsis

Documentation

data LetBinding o a x Source #

Packages a binding along with its free registers that are required for it, which are left existential. This is possible since the Regs datatype serves as a singleton-style witness of the original registers and their types. It also requires Metadata to be provided, sourced from analysis.

Since: 1.5.0.0

Constructors

LetBinding 

Fields

data Metadata Source #

This is used to store useful static information that can be used to guide code generation.

See successInputCharacteristic, and failureInputCharacteristic.

Since: 1.5.0.0

data InputCharacteristic Source #

Provides a way to describe how input is consumed in certain circumstances:

  • The input may be always the same on all paths
  • The input may always be consumed, but not the same on all paths
  • The input may never be consumed in any path
  • It may be inconsistent

Since: 1.5.0.0

Constructors

AlwaysConsumes (Maybe Word)

On all paths, input must be consumed: Nothing when the extact amount is inconsistent across paths.

NeverConsumes

On all paths, no input is consumed.

MayConsume

The input characteristic is unknown or inconsistent.

data Regs (rs :: [Type]) where Source #

Represents a collection of free registers, preserving their type information as a heterogeneous list.

Since: 1.0.0.0

Constructors

NoRegs :: Regs '[] 
FreeReg :: ΣVar r -> Regs rs -> Regs (r ': rs) 

makeLetBinding :: Binding o a x -> Set SomeΣVar -> Metadata -> LetBinding o a x Source #

Given a Binding , a set of existential ΣVars, and some Metadata, produces a LetBinding instance.

Since: 1.5.0.0

newMeta :: Metadata Source #

Produces a new Metadata object, with fields initialised to sensible conservative defaults.

Since: 1.5.0.0

successInputCharacteristic :: Metadata -> InputCharacteristic Source #

Characterises the way that a binding consumes input on success.

Since: 1.5.0.0

failureInputCharacteristic :: Metadata -> InputCharacteristic Source #

Characterises the way that a binding consumes input on failure.

Since: 1.5.0.0

type Binding o a x = Fix4 (Instr o) '[] One x a Source #

Type represents a binding, which is a completed parser that can be refered to by other parsers. This is characterised by requiring no initial stack and exactly one handler. The top-level binding is the one of type Binding o a a.

Since: 1.0.0.0