Previous Next Contents

9   Sharing constraints

Let the name of the parser be denoted by {n}. If you have not created a lexer which takes an argument, and you have followed the directions given earlier for creating the parser, you will have the following structures with the following signatures:
(* always present *)

signature TOKEN
signature LR_TABLE
signature STREAM
signature LR_PARSER
signature PARSER_DATA
structure LrParser : LR_PARSER

(* signatures generated by ML-Yacc *)

signature {n}_TOKENS
signature {n}_LRVALS

(* structures created by you *)

structure {n}LrVals : {n}_LRVALS
structure Lex : LEXER
structure {n}Parser : PARSER
The following sharing constraints will exist:
sharing {n}Parser.Token = LrParser.Token =
sharing {n}Parser.Stream = LrParser.Stream

sharing type {n}Parser.arg = {n}LrVals.ParserData.arg
sharing type {n}Parser.result = {n}LrVals.ParserData.result
sharing type {n}Parser.pos = {n}LrVals.ParserData.pos =
sharing type {n}Parser.svalue = {n}LrVals.ParserData.svalue =
        {n}LrVals.Tokens.svalue = Lex.UserDeclarations.svalue
sharing type {n}Parser.Token.token =
           {n}LrVals.ParserData.Token.token =
           LrParser.Token.token =

sharing {n}LrVals.LrTable = LrParser.LrTable
If you used a lexer which takes an argument, then you will have:
structure ARG_LEXER
structure {n}Parser : PARSER

(* additional sharing constraint *)

sharing type {n}Parser.lexarg = Lex.UserDeclarations.arg

Previous Next Contents