# Mythryl-Yacc Parser Generator (c) 1989 Andrew W. Appel, David R. Tarditi
# Compiled by:
#
src/app/yacc/src/mythryl-yacc.lib### "We're fools whether we dance or not,
### so we might as well dance."
###
### -- Japanese proverb
stipulate
package fil = file__premicrothread; # file__premicrothread is from
src/lib/std/src/posix/file--premicrothread.pkgherein
generic package parse_gen_parser_g (
# ==================
#
package header: Header; # Header is from
src/app/yacc/src/header.api package parser: Arg_Parser # Arg_Parser is from
src/app/yacc/lib/base.api where
Source_Position == header::Source_Position;
sharing parser::Result == header::Parse_Result;
sharing parser::Arg == header::Input_Source == parser::Lex_Arg;
)
: (weak) Parse_Gen_Parser # Parse_Gen_Parser is from
src/app/yacc/src/parse-gen-parser.api {
package header = header; # Export to client packages.
#
fun parse file
=
(result, source)
where
in_str = fil::open_for_read file;
source = header::make_source (file, in_str, fil::stdout);
error = \\ (s: String, i: Int, _)
=
header::error source i s;
stream = parser::make_lexer
(\\ i = (fil::read_n (in_str, i)))
source;
my (result, _)
=
{ header::lineno := 1;
header::text := NIL;
parser::parse (15, stream, error, source);
};
fil::close_input in_str;
end;
};
end;