## mythryl-lex-input.pkg
## John Reppy (http://www.cs.uchicago.edu/~jhr)
## Aaron Turon (adrassi@gmail.com)
## All rights reserved.
# Compiled by:
#
src/app/future-lex/src/lexgen.lib# Driver for mythryl-lex input format.
stipulate
package fil = file__premicrothread; # file__premicrothread is from
src/lib/std/src/posix/file--premicrothread.pkgherein
package mllex_input {
#
package mllex_lr_vals
=
ml_lex_lr_vals_fun (package token = lr_parser::token;);
package mllex_lex
=
mllex_lex_g (package tok = mllex_lr_vals::tokens;);
package mllex_parser
=
make_complete_yacc_parser_g (
package parser_data = mllex_lr_vals::parser_data;
package lex = mllex_lex;
package lr_parser = lr_parser;
);
fun parse_file fname
=
{ fun parse_err (msg, line, _)
=
{ print (int::to_string line);
print ": ";
print msg;
print "\n";
};
stream = fil::open_for_read fname;
lexer = mllex_parser::make_lexer (\\ n = fil::read_n (stream, n));
#1 (mllex_parser::parse (15, lexer, parse_err, ()))
then
fil::close_input stream;
};
};
end;
## COPYRIGHT (c) 2005
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.