Provided by: smlsharp_4.0.0+git20211227.5af5945b-2_amd64 bug

NAME

       smllex - the lexical analyzer generator for SML#

SYNOPSIS

       smllex [-o file] filename ...

DESCRIPTION

       SMLLex  is  a  lexical  analyzer generator in the style of ML-Lex.  It accepts input files
       designed for ML-Lex.  Generated programs can be compiled by the SML# compiler.   They  are
       compatible to those of ML-Lex with a few exceptions.

       When  multiple  input  files  are  given,  each input file is separately read and yields a
       separate program.  By default, the output file name is obtained by appending  .sml  suffix
       to the input file name.

       To  compile the generated program with SML#, an interface file (.smi file) is needed.  See
       EXAMPLES for details.

   OPTIONS
       -o filename
              Set the output file name of the first input.

EXAMPLES

       The following is a minimal example of an input file ex.lex:

              type lexresult = bool option
              fun eof () = NONE
              %%
              %structure ExampleLex
              %%
              "T" => (SOME true);
              "F" => (SOME false);

       By applying this file to smllex,

              smllex ex.lex

       you obtains a program named ex.lex.sml.  To compile it, you need to create  the  following
       ex.lex.smi file by yourself:

              _require "basis.smi"
              structure ExampleLex =
              struct
                exception LexError
                val makeLexer : (int -> string) -> unit -> bool option
              end

       When your .lex file has an %arg, directive, for example,

              type lexresult = bool option
              fun eof {inverse} = NONE
              %%
              %structure Example2Lex
              %arg ({inverse});
              %%
              "T" => (SOME (if inverse then false else true));
              "F" => (SOME (if inverse then true else false));

       the generated makeLexer function takes an additional argument:

              _require "basis.smi"
              structure Example2Lex =
              struct
                exception LexError
                val makeLexer : (int -> string) -> {inverse : bool}
                                -> unit -> bool option
              end

HISTORY

       SMLLex  is a derivative of ML-Lex, which is originally developed by Andrew W. Appel, James
       S. Mattson, and David R. Tarditi.

       Major changes from the orginal ML-Lex includes the following:

       •   The command line option -o is added.

       •   The character position starts with 0, not 2.

       •   The generated program does not use Unsafe features of SML/NJ.

SEE ALSO

       smlyacc(1)
       A lexical analyzer generator for Standard ML, available  at  https://www.smlnj.org/doc/ML-
       Lex/manual.html
       SML# Document, available at https://www.pllab.riec.tohoku.ac.jp/smlsharp/docs/

                                                                                        SMLLEX(1)