package pratter

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

Module Pratter.MakeSource

Parameters

module Sup : SUPPORT

Signature

Sourceexception OpConflict of Sup.term * Sup.term

Raised when there is a priority or associativiy conflict between two operators. The arguments are the terms that generate the conflict.

Sourceexception TooFewArguments

Raised when more arguments are expected. It is raised for instance on partial application of operators, such as x +.

Sourceval expression : Sup.table -> Sup.term Stream.t -> Sup.term

expression tbl s parses stream of tokens s with table of operators tbl. It transforms a sequence of applications to a structured application tree containing infix and prefix operators. For instance, assuming that + is declared infix, it transforms 3 + 5 + 2, represented as @(@(@(@(3,+),5),+),2) (where @ is the application) into (@(+(@(+,3,5)),2).

  • raises TooFewArguments

    when the stream s is empty or does not have enough elements.

  • raises OpConflict

    when the input terms cannot be parenthesised unambiguously.