package lrgrep

  1. Overview
  2. Docs
Detailed error messages for Menhir-generated parsers

Install

dune-project
 Dependency

Authors

Maintainers

Sources

lrgrep-0.9.tbz
sha256=e53de12e4c5cbe6bca00643593266b4f9fa2e3f6a138195eeff7a4329f5c1c75
sha512=7fd7c4d11506fea7cc11c9bbf5aea9142d905643553c0c90e1bb16b794106b0c14a266acf89ae91b6929008dc0ba6515f788642873e2e4ba6c3d49bd45d25127

doc/kernel/Kernel/Info/index.html

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:

  • The Load_grammar functor takes Menhir's grammar representation and computes all index structures for the grammar.
  • Types for grammar elements with their indices:
  • terminal, nonterminal, symbol, production, item
  • lr0, lr1: LR(0) and LR(1) states
  • goto_transition, shift_transition, transition: Transitions
  • reduction: Reductions
  • Module interfaces for each grammar element:
  • Terminal, Nonterminal, Symbol, Production, Item
  • Lr0, Lr1, Transition, Reduction

Each module provides:

  • cardinal: The size of the index set
  • of_int: Construct an index from an integer
  • Type-specific functions for accessing properties
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)