diff options
-rw-r--r-- | README.md | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -1,7 +1,7 @@ | |||
1 | # MoonPlus | 1 | # MoonPlus |
2 | 2 | ||
3 |  | 3 |  |
4 | MoonPlus is a compiler with features from Moonscript language 0.5.0 and could be faster than the original Moonscript compiler. | 4 | MoonPlus is a compiler with features from [Moonscript language](https://github.com/leafo/moonscript) 0.5.0 and could be faster than the original Moonscript compiler. |
5 | 5 | ||
6 | ## Features | 6 | ## Features |
7 | 7 | ||
@@ -12,8 +12,10 @@ MoonPlus is a compiler with features from Moonscript language 0.5.0 and could be | |||
12 | 12 | ||
13 | ## Changes | 13 | ## Changes |
14 | 14 | ||
15 | * Add multi-line comment support. | 15 | The original Moonscript language 0.5.0 support can be found in the `0.5.0` branch. Moonscript with new features is in the master branch. Here are the new features introduced in MoonPlus |
16 | * Add usage for symbol `\` to escape new line. Will compile codes: | 16 | |
17 | * Multi-line comment. | ||
18 | * Usage for symbol `\` to escape new line. Will compile codes: | ||
17 | ```Moonscript | 19 | ```Moonscript |
18 | str = --[[ | 20 | str = --[[ |
19 | This is a multi line comment. | 21 | This is a multi line comment. |
@@ -30,7 +32,7 @@ local str = strA .. strB .. strC | |||
30 | func("192.168.126.110", 3000) | 32 | func("192.168.126.110", 3000) |
31 | ``` | 33 | ``` |
32 | 34 | ||
33 | * Add back call features support with new operator and syntax. For example: | 35 | * Back call features with new operator and syntax. For example: |
34 | ```Moonscript | 36 | ```Moonscript |
35 | {1,2,3} \ | 37 | {1,2,3} \ |
36 | |> map((x)-> x * 2) \ | 38 | |> map((x)-> x * 2) \ |
@@ -45,7 +47,7 @@ do | |||
45 | body[".result"]\append processed | 47 | body[".result"]\append processed |
46 | print "done" | 48 | print "done" |
47 | ``` | 49 | ``` |
48 |   compiles to: | 50 |   will be compiled to: |
49 | ```Lua | 51 | ```Lua |
50 | print(reduce(filter(map({ | 52 | print(reduce(filter(map({ |
51 | 1, | 53 | 1, |
@@ -69,7 +71,7 @@ do | |||
69 | end | 71 | end |
70 | ``` | 72 | ``` |
71 | 73 | ||
72 | * Add existential operator support. Generate codes from: | 74 | * Existential operator support. Generate codes from: |
73 | ```Moonscript | 75 | ```Moonscript |
74 | func?! | 76 | func?! |
75 | 77 | ||
@@ -104,7 +106,7 @@ if print and (x ~= nil) then | |||
104 | end | 106 | end |
105 | ``` | 107 | ``` |
106 | 108 | ||
107 | * Add more features for `import` keyword. Will compile codes from: | 109 | * More usages for `import` keyword. Will compile codes from: |
108 | ```Moonscript | 110 | ```Moonscript |
109 | import 'module' | 111 | import 'module' |
110 | import "module.part" | 112 | import "module.part" |
@@ -136,7 +138,7 @@ local _call_4 = _call_3["then"](_call_3, "xyz") | |||
136 | _call_4["else"](_call_4, res) | 138 | _call_4["else"](_call_4, res) |
137 | ``` | 139 | ``` |
138 | 140 | ||
139 | * Add feature of `reusing variable` which helps generate reduced Lua codes. For example, MoonPlus will generate codes from: | 141 | * Feature of `Reusing variable` which helps generate reduced Lua codes. For example, MoonPlus will generate codes from: |
140 | ```Moonscript | 142 | ```Moonscript |
141 | with leaf | 143 | with leaf |
142 | .world 1,2,3 | 144 | .world 1,2,3 |