## parser-combinator.api
# Compiled by:
#
src/lib/std/standard.lib# Parser combinators over readers. These are modeled after the Haskell
# combinators of Hutton and Meijer. The main difference is that they
# return a single result, instead of a list of results. This means that
# "or" is a committed choice; once one branch succeeds, the others will not
# be enabled. While this is somewhat limiting, for many applications it
# will not be a problem. For more substantial parsing problems, one should
# use Mythryl-Yacc and/or Mythryl-Lex.
### "You may have any combination of features the
### Air Ministry desires, so long as you do not also
### require that the resulting airplane fly."
###
### -- Willy Messerschmidt
api Parser_Combinator {
Parser (X, A_strm)
=
number_string::Reader (Char, A_strm) -> number_string::Reader (X, A_strm);
result: X -> Parser( X, A_strm );
failure: Parser( X, A_strm );
wrap: ((Parser( X, A_strm ), (X -> Y))) -> Parser( Y, A_strm );
seq: ((Parser( X, A_strm ), Parser( Y, A_strm ))) -> Parser( ((X, Y)), A_strm );
seq_with: (((X, Y)) -> Z)
-> ((Parser( X, A_strm ), Parser( Y, A_strm )))
-> Parser( Z, A_strm );
bind: ((Parser( X, A_strm ), (X -> Parser( Y, A_strm ))))
-> Parser( Y, A_strm );
eat_char: (Char -> Bool) -> Parser( Char, A_strm );
char: Char -> Parser( Char, A_strm );
string: String -> Parser( String, A_strm );
skip_before: (Char -> Bool) -> Parser( X, A_strm ) -> Parser( X, A_strm );
or_op: ((Parser( X, A_strm ), Parser( X, A_strm ))) -> Parser( X, A_strm );
or' : List( Parser( X, A_strm ) ) -> Parser( X, A_strm );
zero_or_more: Parser( X, A_strm ) -> Parser( List(X), A_strm );
one_or_more: Parser( X, A_strm ) -> Parser( List(X), A_strm );
option: Parser( X, A_strm ) -> Parser( Null_Or(X), A_strm );
join: Parser( Null_Or(X), A_strm ) -> Parser( X, A_strm );
token: (Char -> Bool) -> Parser( String, A_strm );
# parse a token consisting of characters satisfying the predicate.
# If this succeeds, then the resulting string is guaranteed to be
# non-empty.
};
## COPYRIGHT (c) 1996 AT&T Research.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.