Module Kernel.InfoSource

Grammar information interface

This module exports data structures and operations for handling grammar information. It provides indexed representations of grammars with type-level cardinalities for type-safe access.

Main components:

Each module provides:

Sourcemodule type GRAMMAR = MenhirSdk.Cmly_api.GRAMMAR
Sourcetype 'g grammar
Sourcemodule Load_grammar (G : MenhirSdk.Cmly_api.GRAMMAR) : sig ... end
Sourcetype 'g terminal
Sourcetype 'g nonterminal
Sourcetype 'g production
Sourcetype 'g item
Sourcetype 'g lr0
Sourcetype 'g lr1
Sourcetype 'g goto_transition
Sourcetype 'g shift_transition
Sourcetype 'g reduction
Sourcemodule type INDEXED = sig ... end
Sourcemodule Terminal : sig ... end
Sourcemodule Nonterminal : sig ... end
Sourcemodule Symbol : sig ... end
Sourcemodule Production : sig ... end
Sourcemodule Item : sig ... end

Explicit representation of LR(0) items. An item is a production with a dot position: A -> α . β. Items are indexed globally across all productions for efficient set operations. The dot position ranges from 0 (before all RHS symbols) to length (after all).

Sourcemodule Lr0 : sig ... end

LR(0) state information. LR(0) states represent the "core" of LR(1) states, ignoring lookahead information.

Sourcemodule Lr1 : sig ... end

LR(1) state information. LR(1) states extend LR(0) cores with lookahead information, determining when reductions should be performed.

Sourcemodule Transition : sig ... end
Sourcemodule Reduction : sig ... end

Reduction information. A reduction represents a (state, production, lookahead set) triple, meaning that in the given state, when the lookahead terminal is in the set, the parser should reduce by the given production.

Sourceval raw : _ grammar -> (module MenhirSdk.Cmly_api.GRAMMAR)