SML# Document Version 3.7.1
30 A parser generator smlyacc and smllex

30.1 The generated files

The SML# installer will compile and install smlyacc and smllex commands, which are used to generate the SML# system. These commands generates the following SML# source files.

command input file generated files Contents
smlyacc ⟨YaccInputFileName⟩.grm ⟨YaccInputFileName⟩.grm.sml A Parser Program
⟨YaccInputFileName⟩.grm.sig Parser’s Token signature
⟨YaccInputFileName⟩.grm.desc LR automaton state descriptions
smllex ⟨LexInputFileName⟩.lex ⟨LexInputFileName⟩.lex.sml A Lexical analyzer
  • •

    smlyacc command only takes an input file name ⟨YaccInputFileName⟩.grm. The output file name can be specified with the following environment variable:

    SMLYACC_OUTPUT=⟨YaccOutputFileName⟩.sml

    The specification of the output file includes its suffix (.sml). With this environment variable is set, smlyacc generates the token signature at the top of the output file.

  • •

    smllex command only takes an input file name ⟨LexInputFileName⟩.lex. The output file name can be specified with the following environment variable:

    SMLLEX_OUTPUT=⟨LexOutputFileName⟩.sml

    The specification of the output file includes its suffix (.sml).