summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2020-01-12 21:44:55 +0800
committerLi Jin <dragon-fly@qq.com>2020-01-12 21:44:55 +0800
commita0d860c9bc4b994854149db58333bc0e04c315c6 (patch)
treeab75148c515d20be81ba4f08c562c1f240e2def7
parentd35732a2f6883bd978c01dd05c37ab51f3a9bdba (diff)
downloadyuescript-a0d860c9bc4b994854149db58333bc0e04c315c6.tar.gz
yuescript-a0d860c9bc4b994854149db58333bc0e04c315c6.tar.bz2
yuescript-a0d860c9bc4b994854149db58333bc0e04c315c6.zip
update readme.
-rw-r--r--README.md69
1 files changed, 67 insertions, 2 deletions
diff --git a/README.md b/README.md
index 1d843b2..ecfca3a 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,67 @@
1# MoonParser 1# MoonPlus
2Try writing a parser for Moonscript language in C++. 2
3MoonPlus is a compiler for Moonscript language 0.5.0 written in C++ which could be 2~4 times faster than the original Moonscript compiler written in Moonscript.
4
5## Features
6
7* No other dependencies needed except modified **parserlib** library from Achilleas Margaritis with some performance enhancement. **lpeg** library is no longer needed.
8* Written in C++17.
9* Support full Moonscript language features, generate the same Lua codes with original compiler.
10* Reserve line numbers from source Moonscript codes in compiled Lua codes to help with debugging.
11
12## Minor Changes
13
14* Can do slash call with Lua keyword. Generate codes from:
15```Moonscript
16c.repeat.if\then("xyz")\else res
17```
18&emsp;&emsp;to:
19```Moonscript
20local _call_3 = c["repeat"]["if"]
21local _call_4 = _call_3["then"](_call_3, "xyz")
22_call_4["else"](_call_4, res)
23```
24
25* Add a compiler flag `reuseVariable` which can help generate reduced Lua codes. For example, when set `reuseVariable` to `true`. Will generate codes from:
26```Moonscript
27with leaf
28 .world 1,2,3
29
30with leaf
31 g = .what.is.this
32 print g
33
34for x in *something
35 print x
36```
37&emsp;&emsp;to:
38```lua
39leaf.world(1, 2, 3)
40do
41 local g = leaf.what.is.this
42 print(g)
43end
44for _index_0 = 1, #something do
45 local x = something[_index_0]
46 print(x)
47end
48```
49&emsp;&emsp;instead of:
50```lua
51do
52 local _with_0 = leaf
53 _with_0.world(1, 2, 3)
54end
55do
56 local _with_0 = leaf
57 local g = _with_0.what.is.this
58end
59local _list_0 = something
60for _index_0 = 1, #_list_0 do
61 local x = _list_0[_index_0]
62 print(x)
63end
64```
65
66## License
67MIT \ No newline at end of file