Module Cf_lex

module Cf_lex: sig .. end

Lexical analysis with functional composition of regular grammars.


Overview

This module implements functional parsers on octet character sequences using regular expressions and functional composition of lazy deterministic finite automata.

Core Interface
type x = Cf_regex.DFA.x 

The type of regular expressions.

type 'a r = 'a Cf_regex.DFA.r 

The type of lexical analysis rules.

type 'a t = (char, 'a) Cf_parser.t 

Character stream parser.

val nil : x

Epsilon, i.e. a subexpression that matches an empty input sequence.

val create : 'a r -> 'a t

Use create r to compose a lexical analyzer from the rule r.

module type Expr_Op_T = sig .. end

The module type containing the subexpression composition operators.

module Op: sig .. end

Open this module to bring the operator functions for simple parsers into the current scope.

module X: sig .. end

A module of parser extensions for working with input sequences that require position information to woven into the parse function.

type counter = {
   c_pos : int; (*

The character index (counts from zero).

*)
   c_row : int; (*

The column number (counts from zero).

*)
   c_col : int; (*

The row number (counts from zero).

*)
}

A record used by the cursor class defined below that indicates the character index, row and column in the input stream associated with a cursor position.

val counter_zero : counter

The initial value of a cursor position counter.

class cursor : ?c:counter -> string -> object .. end

A class derived from Cf_parser.cursor that intercepts newline characters to track the row and column of a cursor position.