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.Types.Base

Description

This module contains the core types of components that make up the underlying machinery for compiled code.

Since: 1.4.0.0

Synopsis

Documentation

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 

type Subroutine# s o a x Source #

Arguments

 = Cont# s o a x

What to do when this parser returns

-> Handler# s o a

How to handle failure within the call

-> Pos

The current position

-> Rep o

The input on entry to the call

-> ST s (Maybe a) 

Subroutine# represents top-level parsers, which require a return continuation, input, an error handler in order to produce (or contribute to) a result of type a.

Since: 1.4.0.0

type Cont# s o a x Source #

Arguments

 = x

The value to be returned to the caller

-> Pos

The current position

-> Rep o

The new input after the call is executed

-> ST s (Maybe a) 

Cont# represents return continuation from recursive parsers. They feed back their result x back to the caller as well as the updated input.

Since: 1.4.0.0

type Handler# s o a Source #

Arguments

 = Pos

The current position

-> Rep o

The current input on failure

-> ST s (Maybe a) 

Handler# represents the functions that handle failure within a parser. For most of their life, handlers are represented as StaHandler, but Handler# is used at the boundaries, such as for recursion.

Since: 1.4.0.0

type Pos = Word# Source #

The type of positions within a parser. This may or may not be packed into a single Word#

Since: 1.8.0.0