File: atleast.doc

package info (click to toggle)
hol-light 20170109-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 36,568 kB
  • ctags: 8,549
  • sloc: ml: 540,018; cpp: 439; lisp: 286; java: 279; makefile: 262; sh: 229; yacc: 108; perl: 78; ansic: 57; sed: 39
file content (29 lines) | stat: -rw-r--r-- 1,035 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
\DOC atleast

\TYPE {atleast : int -> ('a -> 'b * 'a) -> 'a -> 'b list * 'a}

\SYNOPSIS
Parses at least a given number of successive items using given parser.

\DESCRIBE
If {p} is a parser and {n} an integer, {atleast n p} is a new parser
that attempts to parse at least {n} successive items using parser {p} and fails
otherwise. Unless {n} is positive, this is equivalent to {many p}.

\FAILURE
The call to {atleast n p} itself never fails.

\COMMENTS
This is one of a suite of combinators for manipulating ``parsers''. A parser is
simply a function whose OCaml type is some instance of
{:('a)list -> 'b * ('a)list}. The function should take a list of objects of
type {:'a} (e.g. characters or tokens), parse as much of it as possible from
left to right, and return a pair consisting of the object derived from parsing
(e.g. a term or a special syntax tree) and the list of elements that were not
processed.

\SEEALSO
++, |||, >>, a, atleast, elistof, finished, fix, leftbin, listof, many, nothing,
possibly, rightbin, some.

\ENDDOC