next node: ParserLCompose,
prev node: Subsystem Parser Light,
up to node: Subsystem Parser Light


ParserL

Signature of ParserL

List of Import References :
See BOOL
See Char
See DENOTATION
See Nat
See Option
See Seq
See String

SIGNATURE ParserL[data]

$Date: 2010-09-30 18:24:17 +0200 (Do, 30. Sep 2010) $ ($Revision: 616 $)

Parameter

SORT data

Imports

IMPORT String ONLY string
       Option[data] ONLY option

Data Type

The function should remove the prefix it recognizes from the string, and return avail of the data in question. The law
asFct(s) === (nil, s1) ==> s === s1
is expected to hold; note that the converse is not true!

TYPE parser == asParser(asFct: string -> option[data] ** string)

Basic Parsers

always succeeds, recognizes the empty string and returns data.

FUN succeed: data -> parser

never succeeds

FUN break: parser

recognizes the given denotation, returns data

FUN |-> : denotation ** data -> parser

Applying Parsers

just forget the second component of the asFct result

FUN @ : parser ** string -> option[data]

unpack the result, abort if parser failed

FUN @! : parser ** string -> data

Alternative

order matters, first parser is tried first

FUN | : parser ** parser -> parser


next node: ParserLCompose,
prev node: Subsystem Parser Light,
up to node: Subsystem Parser Light