diff options
Diffstat (limited to '')
-rw-r--r-- | LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/README | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/README b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/README new file mode 100644 index 0000000..b6a65d2 --- /dev/null +++ b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/README | |||
@@ -0,0 +1,122 @@ | |||
1 | nat-5.0.3 | ||
2 | |||
3 | This directory contains versions of front end files that are rewritten | ||
4 | to be more "native" to Lua. These files should be considered as | ||
5 | exercises in exploring ways to write the front end, for example, to | ||
6 | write a front end that is optimized for size, etc. See also file size | ||
7 | data further below. | ||
8 | |||
9 | The following are the different versions available (mk2 == "mark 2", | ||
10 | this is commonly used in the UK, e.g. for aeroplanes during WWII): | ||
11 | |||
12 | Lexers | ||
13 | ------ | ||
14 | |||
15 | WARNING: Theses lexer may or may not exhibit exact behaviour when lexing | ||
16 | strings or long strings with embedded CRLF newlines. The CRLF sequence | ||
17 | may be translated into LF (the reference manual is unclear on this.) The | ||
18 | user is advised to stick to LF line endings exclusively. | ||
19 | |||
20 | llex_mk2 Rewritten from original ported code to become more | ||
21 | Lua-like. Still uses a stream-based input interface. | ||
22 | MK2 still scans using a per-character function that | ||
23 | is pretty inefficient. | ||
24 | |||
25 | Status: TESTED | ||
26 | |||
27 | llex_mk3 A rewritten version of MK2 that needs input to be | ||
28 | entered as a single string. Unless an application's | ||
29 | need is very unusual, this should not be a problem. | ||
30 | It will not work for per-line interaction, though. | ||
31 | MK3 no longer needs stream input functions. This | ||
32 | version is also heavily optimized for size. MK3 scans | ||
33 | using find functions and doesn't create many strings. | ||
34 | |||
35 | Status: TESTED | ||
36 | |||
37 | llex_mk4 A rewritten version of MK3 that is line-oriented. | ||
38 | This allows a command-line version that works in the | ||
39 | usual way to be written. | ||
40 | |||
41 | Status: TESTED | ||
42 | |||
43 | The following is a comparison of file sizes (as of 20061111): | ||
44 | |||
45 | lzio llex TOTAL Speed (2) | ||
46 | (bytes) (bytes) (bytes) (KB/s) | ||
47 | ---------------------------------------------- | ||
48 | Binary (Mingw) 416 5312 5728 N/A | ||
49 | ---------------------------------------------- | ||
50 | (in orig-5.0.3:) | ||
51 | ---------------------------------------------- | ||
52 | normal 2219 12639 14585 404.9 | ||
53 | stripped 1292 7618 8910 | ||
54 | ---------------------------------------------- | ||
55 | (in nat-5.0.3:) | ||
56 | ---------------------------------------------- | ||
57 | mk2 1995 7628 9623 469.5 | ||
58 | mk2-stripped 1195 4003 5298 | ||
59 | ---------------------------------------------- | ||
60 | mk3 (1) - 6552 6552 1870.8 | ||
61 | mk3-stripped - 3286 3286 | ||
62 | ---------------------------------------------- | ||
63 | mk4 1337 6956 8293 802.9 | ||
64 | mk4-stripped 798 3457 4225 | ||
65 | ---------------------------------------------- | ||
66 | |||
67 | (1) mk3 does not have a file input streaming function | ||
68 | |||
69 | (2) Speed was benchmarked using a Sempron 3000+. Benchmark scripts are | ||
70 | in the test directories. Best of first three figures quoted. This is a | ||
71 | measurement of raw lexer speed, i.e. tokens are read but no processing | ||
72 | is done. All files are read in entirely before running the lexer. | ||
73 | |||
74 | The performance of the orig-5.0.3 parser is probably a whole magnitude | ||
75 | less than the orig-5.0.3 lexer performance. | ||
76 | |||
77 | Parsers | ||
78 | ------- | ||
79 | |||
80 | lparser_mk3 Written for the simplified lexer interface of llex_mk3+. | ||
81 | (Should be compatible with llex_mk4 too, but untested.) | ||
82 | This is a lexer skeleton, stripped of codegen code. See | ||
83 | the comments in the source code for more information. | ||
84 | Without logging messages and comments, it's under 600 LOC. | ||
85 | |||
86 | Sample output of the parser message logger can be found | ||
87 | in the test/parser_log subdirectory. | ||
88 | |||
89 | Tested with test_parser-5.0.lua, the Lua 5.0.x parser test | ||
90 | cases in the test_lua/ directory, appears to be fine. | ||
91 | |||
92 | Status: SNIPPETS APPEAR TO WORK | ||
93 | |||
94 | lparser_mk3b As above, with variable management code added. In order | ||
95 | to use the parser usefully, variable management code is | ||
96 | a big step forward, allowing the parser to differentiate | ||
97 | locals, upvalues and globals. The number of added lines | ||
98 | is around 100 LOC. A binary chunk of lparser_mk3b | ||
99 | (stripped) is 18076 bytes. | ||
100 | |||
101 | Sample output of the parser message logger can be found | ||
102 | in the test/parser_log subdirectory. | ||
103 | |||
104 | Tested with test_parser-5.0.lua, the Lua 5.0.x parser test | ||
105 | cases in the test_lua/ directory, appears to be fine. | ||
106 | |||
107 | Status: SNIPPETS APPEAR TO WORK | ||
108 | |||
109 | There will be no further development beyond lparser_mk3b. Further work | ||
110 | will focus on a 5.1.x equivalent, for which both a parser skeleton and a | ||
111 | parser with full code generation using nicely commented code is planned. | ||
112 | |||
113 | Other notes: | ||
114 | ------------ | ||
115 | |||
116 | For Lua 5.0.2, see Yueliang 0.1.3, which was the last release of Lua | ||
117 | 5.0.2 material. | ||
118 | |||
119 | Test scripts for the lexer should probably be consolidated, but it's a | ||
120 | little difficult because not all lexers give the same error messages or | ||
121 | use the same token names or format. | ||
122 | |||