Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / guide / localhost / MLLex
CommitLineData
7f918cf1
CE
1<!DOCTYPE html>\r
2<html lang="en">\r
3<head>\r
4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\r
5<meta name="generator" content="AsciiDoc 8.6.9">\r
6<title>MLLex</title>\r
7<link rel="stylesheet" href="./asciidoc.css" type="text/css">\r
8<link rel="stylesheet" href="./pygments.css" type="text/css">\r
9\r
10\r
11<script type="text/javascript" src="./asciidoc.js"></script>\r
12<script type="text/javascript">\r
13/*<![CDATA[*/\r
14asciidoc.install();\r
15/*]]>*/\r
16</script>\r
17<link rel="stylesheet" href="./mlton.css" type="text/css">\r
18</head>\r
19<body class="article">\r
20<div id="banner">\r
21<div id="banner-home">\r
22<a href="./Home">MLton 20180207</a>\r
23</div>\r
24</div>\r
25<div id="header">\r
26<h1>MLLex</h1>\r
27</div>\r
28<div id="content">\r
29<div id="preamble">\r
30<div class="sectionbody">\r
31<div class="paragraph"><p><a href="MLLex">MLLex</a> is a lexical analyzer generator for <a href="StandardML">Standard ML</a>\r
32modeled after the Lex lexical analyzer generator.</p></div>\r
33<div class="paragraph"><p>A version of MLLex, ported from the <a href="SMLNJ">SML/NJ</a> sources, is\r
34distributed with MLton.</p></div>\r
35</div>\r
36</div>\r
37<div class="sect1">\r
38<h2 id="_description">Description</h2>\r
39<div class="sectionbody">\r
40<div class="paragraph"><p>MLLex takes as input the lex language as defined in the ML-Lex manual,\r
41and outputs a lexical analyzer in SML.</p></div>\r
42</div>\r
43</div>\r
44<div class="sect1">\r
45<h2 id="_implementation">Implementation</h2>\r
46<div class="sectionbody">\r
47<div class="ulist"><ul>\r
48<li>\r
49<p>\r
50<a href="https://github.com/MLton/mlton/blob/master/mllex/lexgen.sml"><span class="monospaced">lexgen.sml</span></a>\r
51</p>\r
52</li>\r
53<li>\r
54<p>\r
55<a href="https://github.com/MLton/mlton/blob/master/mllex/main.sml"><span class="monospaced">main.sml</span></a>\r
56</p>\r
57</li>\r
58<li>\r
59<p>\r
60<a href="https://github.com/MLton/mlton/blob/master/mllex/call-main.sml"><span class="monospaced">call-main.sml</span></a>\r
61</p>\r
62</li>\r
63</ul></div>\r
64</div>\r
65</div>\r
66<div class="sect1">\r
67<h2 id="_details_and_notes">Details and Notes</h2>\r
68<div class="sectionbody">\r
69<div class="paragraph"><p>There are 3 main passes in the MLLex tool:</p></div>\r
70<div class="ulist"><ul>\r
71<li>\r
72<p>\r
73Source 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.)\r
74</p>\r
75</li>\r
76<li>\r
77<p>\r
78DFA construction. In this pass, a DFA is constructed by the algorithm of H. Yamada et. al.\r
79</p>\r
80</li>\r
81<li>\r
82<p>\r
83Output. In this pass, the generated DFA is written out as a transition table, along with a table-driven algorithm, to an SML file.\r
84</p>\r
85</li>\r
86</ul></div>\r
87</div>\r
88</div>\r
89<div class="sect1">\r
90<h2 id="_also_see">Also see</h2>\r
91<div class="sectionbody">\r
92<div class="ulist"><ul>\r
93<li>\r
94<p>\r
95<a href="Documentation.attachments/mllex.pdf"><span class="monospaced">mllex.pdf</span></a>\r
96</p>\r
97</li>\r
98<li>\r
99<p>\r
100<a href="MLYacc">MLYacc</a>\r
101</p>\r
102</li>\r
103<li>\r
104<p>\r
105<a href="References#AppelEtAl94">AppelEtAl94</a>\r
106</p>\r
107</li>\r
108<li>\r
109<p>\r
110<a href="References#Price09">Price09</a>\r
111</p>\r
112</li>\r
113</ul></div>\r
114</div>\r
115</div>\r
116</div>\r
117<div id="footnotes"><hr></div>\r
118<div id="footer">\r
119<div id="footer-text">\r
120</div>\r
121<div id="footer-badges">\r
122</div>\r
123</div>\r
124</body>\r
125</html>\r