Skip to content

Commit f048ee1

Browse files
committed
*: Change parsers/* to compilers/* and lexer to parser
1 parent 135dbb8 commit f048ee1

25 files changed

+126
-631
lines changed

bin/compiler/source.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
-- -p | Write output to stdout
99
-- -h | Print help information
1010

11-
local parser = require("fusion.core.parsers.source")
11+
local compiler = require("fusion.core.compilers.source")
1212
local lfs = require("lfs")
1313

1414
local function walk(file_func, dir)
@@ -28,7 +28,7 @@ local function process(file, does_output)
2828
return walk(process, file)
2929
end
3030
local base = file:match("^(.+)%.fuse$")
31-
local output = parser.read_file(file)
31+
local output = compiler.read_file(file)
3232
local output_file = io.open(base .. ".lua", "w")
3333
output_file:write(output .. "\n")
3434
output_file:close()
@@ -44,7 +44,7 @@ while arg_index <= #args do
4444
if _arg == "-p" then
4545
arg_index = arg_index + 1
4646
for i=arg_index, #args do
47-
io.write(parser.read_file(args[i]))
47+
io.write(compiler.read_file(args[i]))
4848
end
4949
break
5050
elseif _arg == "--help" or _arg == "-h" then

bin/interpreter/source.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
-- --metadata <package> | Print metadata for package
99
-- -m <package> | Run <package>.main module
1010
-- -h | Print help information
11-
local parser = require("fusion.core.parsers.source")
12-
parser.inject_loader()
11+
local compiler = require("fusion.core.compilers.source")
12+
compiler.inject_loader()
1313

14-
_G.parser = parser
14+
_G.compiler = compiler
1515

1616
local arg_index = 1
1717
while arg_index <= #arg do
@@ -62,7 +62,7 @@ while arg_index <= #arg do
6262
else -- run a file
6363
local file = assert(arg[arg_index]:match("^.+%.fuse"),
6464
("Incorrect filetype: %s"):format(arg[arg_index]))
65-
parser.do_file(file)
65+
compiler.do_file(file)
6666
break
6767
end
6868
arg_index = arg_index + 1

docs/index.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ <h1>FusionScript</h1>
3131

3232
<h2>Modules</h2>
3333
<ul class="nowrap">
34+
<li><a href="modules/fusion.core.compilers.source.html">fusion.core.compilers.source</a></li>
3435
<li><a href="modules/fusion.core.lexer.html">fusion.core.lexer</a></li>
35-
<li><a href="modules/fusion.core.parsers.source.html">fusion.core.parsers.source</a></li>
3636
<li><a href="modules/fusion.stdlib.class.html">fusion.stdlib.class</a></li>
3737
<li><a href="modules/fusion.stdlib.functional.html">fusion.stdlib.functional</a></li>
3838
<li><a href="modules/fusion.stdlib.iterative.html">fusion.stdlib.iterative</a></li>
@@ -61,12 +61,12 @@ <h2>The programming language of ultimate dankliness</h2>
6161
<h2>Modules</h2>
6262
<table class="module_list">
6363
<tr>
64-
<td class="name" nowrap><a href="modules/fusion.core.lexer.html">fusion.core.lexer</a></td>
65-
<td class="summary">Lex FusionScript files.</td>
64+
<td class="name" nowrap><a href="modules/fusion.core.compilers.source.html">fusion.core.compilers.source</a></td>
65+
<td class="summary">Compile FusionScript AST to Lua code</td>
6666
</tr>
6767
<tr>
68-
<td class="name" nowrap><a href="modules/fusion.core.parsers.source.html">fusion.core.parsers.source</a></td>
69-
<td class="summary">Compile FusionScript AST to Lua code</td>
68+
<td class="name" nowrap><a href="modules/fusion.core.lexer.html">fusion.core.lexer</a></td>
69+
<td class="summary">Lex FusionScript files.</td>
7070
</tr>
7171
<tr>
7272
<td class="name" nowrap><a href="modules/fusion.stdlib.class.html">fusion.stdlib.class</a></td>
@@ -120,7 +120,7 @@ <h2>Topics</h2>
120120
</div> <!-- id="main" -->
121121
<div id="about">
122122
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
123-
<i style="float:right;">Last updated 2016-12-23 15:45:05 </i>
123+
<i style="float:right;">Last updated 2017-05-07 19:28:08 </i>
124124
</div> <!-- id="about" -->
125125
</div> <!-- id="container" -->
126126
</body>

docs/modules/fusion.core.parsers.source.html renamed to docs/modules/fusion.core.compilers.source.html

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ <h2>Contents</h2>
3838

3939
<h2>Modules</h2>
4040
<ul class="nowrap">
41+
<li><strong>fusion.core.compilers.source</strong></li>
4142
<li><a href="../modules/fusion.core.lexer.html">fusion.core.lexer</a></li>
42-
<li><strong>fusion.core.parsers.source</strong></li>
4343
<li><a href="../modules/fusion.stdlib.class.html">fusion.stdlib.class</a></li>
4444
<li><a href="../modules/fusion.stdlib.functional.html">fusion.stdlib.functional</a></li>
4545
<li><a href="../modules/fusion.stdlib.iterative.html">fusion.stdlib.iterative</a></li>
@@ -62,7 +62,7 @@ <h2>Topics</h2>
6262

6363
<div id="content">
6464

65-
<h1>Module <code>fusion.core.parsers.source</code></h1>
65+
<h1>Module <code>fusion.core.compilers.source</code></h1>
6666
<p>Compile FusionScript AST to Lua code</p>
6767
<p>
6868

@@ -72,52 +72,52 @@ <h1>Module <code>fusion.core.parsers.source</code></h1>
7272
<h2><a href="#Functions">Functions</a></h2>
7373
<table class="function_list">
7474
<tr>
75-
<td class="name" nowrap><a href="#parser:new">parser:new ()</a></td>
76-
<td class="summary">Initialize a parser state</td>
75+
<td class="name" nowrap><a href="#compiler:new">compiler:new ()</a></td>
76+
<td class="summary">Initialize a compiler state</td>
7777
</tr>
7878
<tr>
79-
<td class="name" nowrap><a href="#parser:transform">parser:transform (node)</a></td>
79+
<td class="name" nowrap><a href="#compiler:transform">compiler:transform (node)</a></td>
8080
<td class="summary">Transform a node using the registered handler.</td>
8181
</tr>
8282
<tr>
83-
<td class="name" nowrap><a href="#parser:l">parser:l (line)</a></td>
83+
<td class="name" nowrap><a href="#compiler:l">compiler:l (line)</a></td>
8484
<td class="summary">Add indent to a line of text.</td>
8585
</tr>
8686
<tr>
87-
<td class="name" nowrap><a href="#parser:transform_expression_list">parser:transform_expression_list (node)</a></td>
87+
<td class="name" nowrap><a href="#compiler:transform_expression_list">compiler:transform_expression_list (node)</a></td>
8888
<td class="summary">Convert an expression_list field to a transformed list of expressions.</td>
8989
</tr>
9090
<tr>
91-
<td class="name" nowrap><a href="#parser:transform_variable_list">parser:transform_variable_list (node)</a></td>
91+
<td class="name" nowrap><a href="#compiler:transform_variable_list">compiler:transform_variable_list (node)</a></td>
9292
<td class="summary">Convert a variable_list to a transformed list of variable names.</td>
9393
</tr>
9494
<tr>
95-
<td class="name" nowrap><a href="#parser:transform_class_function">parser:transform_class_function (node)</a></td>
95+
<td class="name" nowrap><a href="#compiler:transform_class_function">compiler:transform_class_function (node)</a></td>
9696
<td class="summary">Convert a function field in a class to a lambda table assignment.</td>
9797
</tr>
9898
<tr>
99-
<td class="name" nowrap><a href="#parser.compile">parser.compile (in_values, output_stream)</a></td>
99+
<td class="name" nowrap><a href="#compiler.compile">compiler.compile (in_values, output_stream)</a></td>
100100
<td class="summary">Convert an iterator returning FusionScript chunks to Lua code.</td>
101101
</tr>
102102
<tr>
103-
<td class="name" nowrap><a href="#parser.read_file">parser.read_file (file)</a></td>
103+
<td class="name" nowrap><a href="#compiler.read_file">compiler.read_file (file)</a></td>
104104
<td class="summary">Read FusionScript code from a file and return output.</td>
105105
</tr>
106106
<tr>
107-
<td class="name" nowrap><a href="#parser.load_file">parser.load_file (file)</a></td>
107+
<td class="name" nowrap><a href="#compiler.load_file">compiler.load_file (file)</a></td>
108108
<td class="summary">Load FusionScript code from a file and return a function to run the code.</td>
109109
</tr>
110110
<tr>
111-
<td class="name" nowrap><a href="#parser.do_file">parser.do_file (file)</a></td>
111+
<td class="name" nowrap><a href="#compiler.do_file">compiler.do_file (file)</a></td>
112112
<td class="summary">Load and run FusionScript code from a file</td>
113113
</tr>
114114
<tr>
115-
<td class="name" nowrap><a href="#parser.search_for">parser.search_for (module_name)</a></td>
115+
<td class="name" nowrap><a href="#compiler.search_for">compiler.search_for (module_name)</a></td>
116116
<td class="summary">Find a module in the package path and return relevant information.</td>
117117
</tr>
118118
<tr>
119-
<td class="name" nowrap><a href="#parser.inject_loader">parser.inject_loader ()</a></td>
120-
<td class="summary">Inject <a href="../modules/fusion.core.parsers.source.html#parser.search_for">parser.search_for</a> into the <code>require()</code> searchers list.</td>
119+
<td class="name" nowrap><a href="#compiler.inject_loader">compiler.inject_loader ()</a></td>
120+
<td class="summary">Inject <a href="../modules/fusion.core.compilers.source.html#compiler.search_for">compiler.search_for</a> into the <code>require()</code> searchers list.</td>
121121
</tr>
122122
</table>
123123

@@ -129,11 +129,11 @@ <h2 class="section-header "><a name="Functions"></a>Functions</h2>
129129

130130
<dl class="function">
131131
<dt>
132-
<a name = "parser:new"></a>
133-
<strong>parser:new ()</strong>
132+
<a name = "compiler:new"></a>
133+
<strong>compiler:new ()</strong>
134134
</dt>
135135
<dd>
136-
Initialize a parser state
136+
Initialize a compiler state
137137

138138

139139

@@ -143,8 +143,8 @@ <h2 class="section-header "><a name="Functions"></a>Functions</h2>
143143

144144
</dd>
145145
<dt>
146-
<a name = "parser:transform"></a>
147-
<strong>parser:transform (node)</strong>
146+
<a name = "compiler:transform"></a>
147+
<strong>compiler:transform (node)</strong>
148148
</dt>
149149
<dd>
150150
Transform a node using the registered handler.
@@ -166,8 +166,8 @@ <h3>Parameters:</h3>
166166

167167
</dd>
168168
<dt>
169-
<a name = "parser:l"></a>
170-
<strong>parser:l (line)</strong>
169+
<a name = "compiler:l"></a>
170+
<strong>compiler:l (line)</strong>
171171
</dt>
172172
<dd>
173173
Add indent to a line of text.
@@ -189,8 +189,8 @@ <h3>Parameters:</h3>
189189

190190
</dd>
191191
<dt>
192-
<a name = "parser:transform_expression_list"></a>
193-
<strong>parser:transform_expression_list (node)</strong>
192+
<a name = "compiler:transform_expression_list"></a>
193+
<strong>compiler:transform_expression_list (node)</strong>
194194
</dt>
195195
<dd>
196196
Convert an expression_list field to a transformed list of expressions.
@@ -212,8 +212,8 @@ <h3>Parameters:</h3>
212212

213213
</dd>
214214
<dt>
215-
<a name = "parser:transform_variable_list"></a>
216-
<strong>parser:transform_variable_list (node)</strong>
215+
<a name = "compiler:transform_variable_list"></a>
216+
<strong>compiler:transform_variable_list (node)</strong>
217217
</dt>
218218
<dd>
219219
Convert a variable_list to a transformed list of variable names.
@@ -235,8 +235,8 @@ <h3>Parameters:</h3>
235235

236236
</dd>
237237
<dt>
238-
<a name = "parser:transform_class_function"></a>
239-
<strong>parser:transform_class_function (node)</strong>
238+
<a name = "compiler:transform_class_function"></a>
239+
<strong>compiler:transform_class_function (node)</strong>
240240
</dt>
241241
<dd>
242242
Convert a function field in a class to a lambda table assignment.
@@ -258,8 +258,8 @@ <h3>Parameters:</h3>
258258

259259
</dd>
260260
<dt>
261-
<a name = "parser.compile"></a>
262-
<strong>parser.compile (in_values, output_stream)</strong>
261+
<a name = "compiler.compile"></a>
262+
<strong>compiler.compile (in_values, output_stream)</strong>
263263
</dt>
264264
<dd>
265265
Convert an iterator returning FusionScript chunks to Lua code.
@@ -284,8 +284,8 @@ <h3>Parameters:</h3>
284284

285285
</dd>
286286
<dt>
287-
<a name = "parser.read_file"></a>
288-
<strong>parser.read_file (file)</strong>
287+
<a name = "compiler.read_file"></a>
288+
<strong>compiler.read_file (file)</strong>
289289
</dt>
290290
<dd>
291291
Read FusionScript code from a file and return output.
@@ -311,8 +311,8 @@ <h3>Returns:</h3>
311311

312312
</dd>
313313
<dt>
314-
<a name = "parser.load_file"></a>
315-
<strong>parser.load_file (file)</strong>
314+
<a name = "compiler.load_file"></a>
315+
<strong>compiler.load_file (file)</strong>
316316
</dt>
317317
<dd>
318318
Load FusionScript code from a file and return a function to run the code.
@@ -340,8 +340,8 @@ <h3>Returns:</h3>
340340

341341
</dd>
342342
<dt>
343-
<a name = "parser.do_file"></a>
344-
<strong>parser.do_file (file)</strong>
343+
<a name = "compiler.do_file"></a>
344+
<strong>compiler.do_file (file)</strong>
345345
</dt>
346346
<dd>
347347
Load and run FusionScript code from a file
@@ -363,13 +363,13 @@ <h3>Parameters:</h3>
363363

364364
</dd>
365365
<dt>
366-
<a name = "parser.search_for"></a>
367-
<strong>parser.search_for (module_name)</strong>
366+
<a name = "compiler.search_for"></a>
367+
<strong>compiler.search_for (module_name)</strong>
368368
</dt>
369369
<dd>
370370
Find a module in the package path and return relevant information.
371371
Returns <code>nil</code> and an error message if not found.
372-
Do not use this function by itself; use <code>parser.inject_loader()</code>.
372+
Do not use this function by itself; use <code>compiler.inject_loader()</code>.
373373

374374

375375
<h3>Parameters:</h3>
@@ -397,11 +397,11 @@ <h3>Returns:</h3>
397397

398398
</dd>
399399
<dt>
400-
<a name = "parser.inject_loader"></a>
401-
<strong>parser.inject_loader ()</strong>
400+
<a name = "compiler.inject_loader"></a>
401+
<strong>compiler.inject_loader ()</strong>
402402
</dt>
403403
<dd>
404-
Inject <a href="../modules/fusion.core.parsers.source.html#parser.search_for">parser.search_for</a> into the <code>require()</code> searchers list.
404+
Inject <a href="../modules/fusion.core.compilers.source.html#compiler.search_for">compiler.search_for</a> into the <code>require()</code> searchers list.
405405

406406

407407

@@ -416,7 +416,7 @@ <h3>Returns:</h3>
416416

417417
<h3>Usage:</h3>
418418
<ul>
419-
<pre class="example">parser.inject_loader(); <span class="global">print</span>(<span class="global">require</span>(<span class="string">"test_module"</span>))
419+
<pre class="example">compiler.inject_loader(); <span class="global">print</span>(<span class="global">require</span>(<span class="string">"test_module"</span>))
420420
<span class="comment">-- Attempts to load a FusionScript <code>test_module</code> package</span></pre>
421421
</ul>
422422

@@ -428,7 +428,7 @@ <h3>Usage:</h3>
428428
</div> <!-- id="main" -->
429429
<div id="about">
430430
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
431-
<i style="float:right;">Last updated 2016-12-25 00:12:26 </i>
431+
<i style="float:right;">Last updated 2017-05-07 19:28:08 </i>
432432
</div> <!-- id="about" -->
433433
</div> <!-- id="container" -->
434434
</body>

docs/modules/fusion.core.lexer.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ <h2>Contents</h2>
3939

4040
<h2>Modules</h2>
4141
<ul class="nowrap">
42+
<li><a href="../modules/fusion.core.compilers.source.html">fusion.core.compilers.source</a></li>
4243
<li><strong>fusion.core.lexer</strong></li>
43-
<li><a href="../modules/fusion.core.parsers.source.html">fusion.core.parsers.source</a></li>
4444
<li><a href="../modules/fusion.stdlib.class.html">fusion.stdlib.class</a></li>
4545
<li><a href="../modules/fusion.stdlib.functional.html">fusion.stdlib.functional</a></li>
4646
<li><a href="../modules/fusion.stdlib.iterative.html">fusion.stdlib.iterative</a></li>
@@ -177,7 +177,7 @@ <h3>Fields:</h3>
177177
</div> <!-- id="main" -->
178178
<div id="about">
179179
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
180-
<i style="float:right;">Last updated 2016-12-23 15:45:05 </i>
180+
<i style="float:right;">Last updated 2017-05-07 19:28:08 </i>
181181
</div> <!-- id="about" -->
182182
</div> <!-- id="container" -->
183183
</body>

docs/modules/fusion.stdlib.class.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ <h2>Contents</h2>
3838

3939
<h2>Modules</h2>
4040
<ul class="nowrap">
41+
<li><a href="../modules/fusion.core.compilers.source.html">fusion.core.compilers.source</a></li>
4142
<li><a href="../modules/fusion.core.lexer.html">fusion.core.lexer</a></li>
42-
<li><a href="../modules/fusion.core.parsers.source.html">fusion.core.parsers.source</a></li>
4343
<li><strong>fusion.stdlib.class</strong></li>
4444
<li><a href="../modules/fusion.stdlib.functional.html">fusion.stdlib.functional</a></li>
4545
<li><a href="../modules/fusion.stdlib.iterative.html">fusion.stdlib.iterative</a></li>
@@ -128,7 +128,7 @@ <h3>Returns:</h3>
128128
</div> <!-- id="main" -->
129129
<div id="about">
130130
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
131-
<i style="float:right;">Last updated 2016-12-23 15:45:05 </i>
131+
<i style="float:right;">Last updated 2017-05-07 19:28:08 </i>
132132
</div> <!-- id="about" -->
133133
</div> <!-- id="container" -->
134134
</body>

docs/modules/fusion.stdlib.functional.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ <h2>Contents</h2>
3939

4040
<h2>Modules</h2>
4141
<ul class="nowrap">
42+
<li><a href="../modules/fusion.core.compilers.source.html">fusion.core.compilers.source</a></li>
4243
<li><a href="../modules/fusion.core.lexer.html">fusion.core.lexer</a></li>
43-
<li><a href="../modules/fusion.core.parsers.source.html">fusion.core.parsers.source</a></li>
4444
<li><a href="../modules/fusion.stdlib.class.html">fusion.stdlib.class</a></li>
4545
<li><strong>fusion.stdlib.functional</strong></li>
4646
<li><a href="../modules/fusion.stdlib.iterative.html">fusion.stdlib.iterative</a></li>
@@ -626,7 +626,7 @@ <h3>Returns:</h3>
626626
</div> <!-- id="main" -->
627627
<div id="about">
628628
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
629-
<i style="float:right;">Last updated 2017-02-01 00:01:53 </i>
629+
<i style="float:right;">Last updated 2017-05-07 19:28:08 </i>
630630
</div> <!-- id="about" -->
631631
</div> <!-- id="container" -->
632632
</body>

0 commit comments

Comments
 (0)