Previous Up Next

Interface for module Absynt

This module contains the static definition of transducers, i.e., its abstract syntax together with various related functions. The definition of the transducers is directly given by the type mtt, a tuple of consisting of the components.

The type of symbols is currently not used in every case it shows up. It is intended to keep the name of of the syntactic entity in question. Currently it is represented as a simple string. I decided to introduce a separate type for symbols, to be prepared to replace it with something more efficient than just pure strings. In case of the variable and parameter names, symbols are indeed not really used at all; currently, by convention, variables just use “x” as identifier and what really matter is the integer index for x.

Note that the abstact syntax is general enough for macro tree transducers, as the last argument of the constructor for terms QT takes as last argument a list of terms. For the time being, this list is in many cases assumed to be empty (but some of the simpler functions can handle the more general case already). The rest of the transducer’s components should be self-documenting.

Most of the interface is currently made visible for testing-purposes. In an end-version, we’ll make it opaque.


moduleSymbol=Mtsymbol.Symbol
typesymbol=Symbol.symbol

typevname=symbolנint
typepname=symbolנint(∗ currently not really used ∗)

typeqindex=int
typeqstarindex=qindexlist
typeαstate=Qofα(∗ qiQ1 ∗)

typeαterm=
Vofvname
Pofpname
Tofsymbolנ(αterm)list
QTofαstateנ(αterm)נ(αterm)list

typeαlhsterm(∗ not all terms are correct lhs’s ∗)
typeαrhsterm(∗ note: Q can only be applied to a variable ∗)
typeαrule=(αlhs)נ(αrhs)
typeαqsignature=(αנint)list
typessignature=(symbolנint)list
typeαsignature=(αqsignaturessignature

typeαmtt=symbolנ(αsignature)נ(αstate)listנ(αstate)listנ(αrule)list

valbuild_constructorterm:(symbolנint)→qindexterm
valbuild_constructorterms:((symbolנint)list)→(qindexterm)list
valbuild_constructorterms_in_context:(qindextermqindexterm)→((symbolנint)list)→(qindexterm)list

valbuild_qi_terms:((symbolנint)list)→qindex→(qindexterm)list

valuniquify_rules:(αrule)list→(αrule)list

The remaining functions are for error handling and some data conversion. The lexer, while eating the source code string, will keep track of the number of lines. A state-base implementation works simplest, so line-counting will be done by the lexer communicating by an instance of the linecounter-class.
exceptionMy_Parse_errorofintנintנ(intנint)list
typelexposition={char_start:int;char_end:int;line_no:int}
typeident=Identoflexpositionנsymbol
valline_number:lexpositionint

classlinecounter:
object
valmutablex:int
valmutablem:string
methodnew_line:unitunit
methodget_line:unitint
methodset_message:stringunit
methodget_message:unitstring
end

vallc:linecounter

valident_pos:identlexposition
valpos_conc:lexpositionנlexpositionlexposition
valdetermine_pos:Lexing.lexbuflexposition


Previous Up Next