package menhirCST

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type terminal

A type of terminal symbols.

type nonterminal

A type of nonterminal symbols.

type production = int

A type of productions.

type state

A type of LR(1) states.

val number : state -> int

An injective mapping of states to integers.

type token

A type of tokens.

val token2terminal : token -> terminal

A token is conceptually a pair of a terminal symbol and a semantic value. token2terminal is the first pair projection: it maps a token to the corresponding terminal symbol.

val lhs : production -> nonterminal

lhs prod returns the left-hand side of the production prod.

val maybe_shift_t : state -> terminal -> state option

maybe_shift_t s t determines whether there exists a transition out of the state s, labeled with the terminal symbol t, to some state s'. If so, it returns Some s'. Otherwise, it returns None.

val maybe_goto_nt : state -> nonterminal -> state option

maybe_goto_nt s nt determines whether there exists a transition out of the state s, labeled with the nonterminal symbol nt, to some state s'. If so, it returns Some s'. Otherwise, it returns None.

val may_reduce_prod : state -> terminal -> production -> bool

may_reduce_prod s t prod determines whether in the state s, with lookahead symbol t, the automaton reduces production prod. This test accounts for the possible existence of a default reduction.

OCaml

Innovation. Community. Security.