home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Moscow ML 1.42 / lib / Parsing.sig < prev    next >
Encoding:
Text File  |  1997-08-18  |  2.1 KB  |  59 lines  |  [TEXT/Moml]

  1. (* Parsing -- runtime library for parsers generated by mosmlyac.
  2.    Based on the runtime library for camlyacc; copyright 1993 INRIA, France 
  3.  *)
  4.  
  5. local open Vector Obj Lexing in
  6.  
  7. (* The following functions can be called by user code. *)
  8.  
  9. val symbolStart : unit -> int;
  10. val symbolEnd : unit -> int;
  11.         (* [symbolStart] and [symbolEnd] are to be called in the action part
  12.            of a grammar rule only. They return the position of the string that
  13.            matches the left-hand side of the rule: [symbolStart()] returns
  14.            the position of the first character; [symbolEnd()] returns the
  15.            position of the last character, plus one. The first character
  16.            in a file is at position 0. *)
  17.  
  18. val rhsStart: int -> int;
  19. val rhsEnd: int -> int;
  20.         (* Same as [symbol_start] and [symbol_end] above, but return then
  21.            position of the string matching the [n]th item on the
  22.            right-hand side of the rule, where [n] is the integer parameter
  23.            to [lhs_start] and [lhs_end]. [n] is 1 for the leftmost item. *)
  24.  
  25. val clearParser : unit -> unit;
  26.         (* Empty the parser stack. Call it just after a parsing function
  27.            has returned, to remove all pointers from the parser stack
  28.            to structures that were built by semantic actions during parsing.
  29.            This is optional, but lowers the memory requirements of the
  30.            programs. *)
  31.  
  32. (*--*)
  33.  
  34. (* The following definitions are used by the generated parsers only.
  35.    They are not intended to be used by user programs. *)
  36.  
  37. type parseTables =
  38.     (* actions *)    (unit -> obj) vector  *
  39.     (* transl *)     int vector *
  40.     (* lhs *)        string *
  41.     (* len *)        string *
  42.     (* defred *)     string *
  43.     (* dgoto *)      string *
  44.     (* sindex *)     string *
  45.     (* rindex *)     string *
  46.     (* gindex *)     string *
  47.     (* tablesize *)  int *
  48.     (* table *)      string *
  49.     (* check *)      string
  50. ;
  51.  
  52. exception yyexit of obj;
  53. exception ParseError of (obj -> bool);
  54.  
  55. val yyparse : parseTables -> int -> (lexbuf -> 'a) -> lexbuf -> 'b;
  56. val peekVal : int -> 'a;
  57.  
  58. end;
  59.