4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta name="generator" content="AsciiDoc 8.6.9">
7 <link rel="stylesheet" href="./asciidoc.css" type="text/css">
8 <link rel="stylesheet" href="./pygments.css" type="text/css">
11 <script type="text/javascript" src="./asciidoc.js"></script>
12 <script type="text/javascript">
17 <link rel="stylesheet" href="./mlton.css" type="text/css">
19 <body class="article">
21 <div id="banner-home">
22 <a href="./Home">MLton 20180207</a>
30 <div class="sectionbody">
31 <div class="paragraph"><p><a href="MLLex">MLLex</a> is a lexical analyzer generator for <a href="StandardML">Standard ML</a>
32 modeled after the Lex lexical analyzer generator.</p></div>
33 <div class="paragraph"><p>A version of MLLex, ported from the <a href="SMLNJ">SML/NJ</a> sources, is
34 distributed with MLton.</p></div>
38 <h2 id="_description">Description</h2>
39 <div class="sectionbody">
40 <div class="paragraph"><p>MLLex takes as input the lex language as defined in the ML-Lex manual,
41 and outputs a lexical analyzer in SML.</p></div>
45 <h2 id="_implementation">Implementation</h2>
46 <div class="sectionbody">
47 <div class="ulist"><ul>
50 <a href="https://github.com/MLton/mlton/blob/master/mllex/lexgen.sml"><span class="monospaced">lexgen.sml</span></a>
55 <a href="https://github.com/MLton/mlton/blob/master/mllex/main.sml"><span class="monospaced">main.sml</span></a>
60 <a href="https://github.com/MLton/mlton/blob/master/mllex/call-main.sml"><span class="monospaced">call-main.sml</span></a>
67 <h2 id="_details_and_notes">Details and Notes</h2>
68 <div class="sectionbody">
69 <div class="paragraph"><p>There are 3 main passes in the MLLex tool:</p></div>
70 <div class="ulist"><ul>
73 Source parsing. In this pass, lex source program are parsed into internal representations. The core part of this pass is a hand-written lexer and an LL(1) parser. The output of this pass is a record of user code, rules (along with start states) and actions. (MLLex definitions are wiped off.)
78 DFA construction. In this pass, a DFA is constructed by the algorithm of H. Yamada et. al.
83 Output. In this pass, the generated DFA is written out as a transition table, along with a table-driven algorithm, to an SML file.
90 <h2 id="_also_see">Also see</h2>
91 <div class="sectionbody">
92 <div class="ulist"><ul>
95 <a href="Documentation.attachments/mllex.pdf"><span class="monospaced">mllex.pdf</span></a>
100 <a href="MLYacc">MLYacc</a>
105 <a href="References#AppelEtAl94">AppelEtAl94</a>
110 <a href="References#Price09">Price09</a>
117 <div id="footnotes"><hr></div>
119 <div id="footer-text">
121 <div id="footer-badges">