# export-parse-fn.pkg
#
# Top-level entrypoint for mythryl-yacc:
#
# When a user runs mythryl-yacc from the commandline,
# or when a script runs mythryl-yacc, execution conceptually
# starts at parse_fn() below.
#
#
# Compiled by:
#
src/app/yacc/src/mythryl-yacc.lib### "After three days without reading,
### talk becomes flavorless."
###
### -- Chinese proverb
stipulate
package fil = file__premicrothread; # file__premicrothread is from
src/lib/std/src/posix/file--premicrothread.pkgherein
package export_parse_fn
: (weak)
api {
parse_fn
:
(String, List(String))
->
winix__premicrothread::process::Status;
}
{
fun err msg
=
fil::write (fil::stderr, msg);
include package trap_control_c; # trap_control_c is from
src/lib/std/trap-control-c.pkg exit = winix__premicrothread::process::exit;
fun parse_fn (_, argv)
=
{ fun parse_fn' ()
=
case argv
#
[file] => { parse_fn::parse_fn file; exit winix__premicrothread::process::success; }; # parse_fn is from
src/app/yacc/src/link.pkg _ => { err "Usage: mythryl-yacc filename\n"; exit winix__premicrothread::process::failure; };
esac;
{ catch_interrupt_signal parse_fn'; # catch_interrupt_signal is from
src/lib/std/trap-control-c.pkg #
winix__premicrothread::process::success;
}
except
CONTROL_C_SIGNAL
=>
winix__premicrothread::process::failure;
other_exception
=>
{ err (string::cat [ "? mythryl-yacc: uncaught exception ",
exceptions::exception_message other_exception,
"\n"
]
);
winix__premicrothread::process::failure;
};
end;
};
};
end;
# Mythryl-Yacc Parser Generator (c) 1991 Andrew W. Appel, David R. Tarditi