diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 63 |
1 files changed, 26 insertions, 37 deletions
@@ -1,14 +1,14 @@ | |||
1 | # MoonPlus | 1 | # YueScript |
2 | 2 | ||
3 | |macOS|Linux|Windows| | 3 | |macOS|Linux|Windows| |
4 | |:---:|:---:|:-----:| | 4 | |:---:|:---:|:-----:| |
5 | |||[](https://ci.appveyor.com/project/pigpigyyy/moonplus/branch/master)| | 5 | |||[](https://ci.appveyor.com/project/pigpigyyy/moonplus/branch/master)| |
6 | 6 | ||
7 | MoonPlus is a compiler with features from [Moonscript language](https://github.com/leafo/moonscript) 0.5.0 and adopting new features to make Moonscript more up to date. | 7 | Yuescript is a Moonscript dialect. It is derived from [Moonscript language](https://github.com/leafo/moonscript) 0.5.0 and continuously adopting new features to be more up to date. |
8 | 8 | ||
9 | Since original Moonscript has been used to write web framework [lapis](https://github.com/leafo/lapis) and run a few business web sites like [itch.io](https://itch.io) and [streak.club](https://streak.club) with some large code bases. The original language is getting too hard to adopt new features for those may break the stablility for existing applications. | 9 | Moonscript is a language that compiles to Lua. Since original Moonscript has been used to write web framework [lapis](https://github.com/leafo/lapis) and run a few business web sites like [itch.io](https://itch.io) and [streak.club](https://streak.club) with some large code bases. The original language is getting too hard to adopt new features for those may break the stablility for existing applications. |
10 | 10 | ||
11 | So MoonPlus is a new code base for pushing the language to go forward and being a playground to try introducing new language syntax or programing paradigms to make Moonscript language more expressive and productive. | 11 | So Yuescript is a new code base for pushing the language to go forward and being a playground to try introducing new language syntax or programing paradigms to make Moonscript language more expressive and productive. |
12 | 12 | ||
13 | 13 | ||
14 | 14 | ||
@@ -16,8 +16,9 @@ So MoonPlus is a new code base for pushing the language to go forward and being | |||
16 | 16 | ||
17 | * No other dependencies needed except modified **parserlib** library from Achilleas Margaritis with some performance enhancement. **lpeg** library is no longer needed. | 17 | * No other dependencies needed except modified **parserlib** library from Achilleas Margaritis with some performance enhancement. **lpeg** library is no longer needed. |
18 | * Written in C++17. | 18 | * Written in C++17. |
19 | * Support full Moonscript language features, generate the same Lua codes with original compiler. | 19 | * Support most of the features from Moonscript language. Generate Lua codes in the same way like the original compiler. |
20 | * Reserve line numbers from Moonscript sources in compiled Lua codes to help with debugging. | 20 | * Reserve line numbers from source file in the compiled Lua codes to help debugging. |
21 | * More features like macro, existential operator, backcall operator, Javascript-like export syntax and etc. | ||
21 | * See other details in the [changelog](./CHANGELOG.md). | 22 | * See other details in the [changelog](./CHANGELOG.md). |
22 | 23 | ||
23 | 24 | ||
@@ -26,27 +27,27 @@ So MoonPlus is a new code base for pushing the language to go forward and being | |||
26 | 27 | ||
27 | * **Lua Module** | 28 | * **Lua Module** |
28 | 29 | ||
29 |   Build `moonp.so` file with | 30 |   Build `yue.so` file with |
30 | 31 | ||
31 | ```sh | 32 | ```sh |
32 | > make shared LUAI=/usr/local/include/lua LUAL=/usr/local/lib/lua | 33 | > make shared LUAI=/usr/local/include/lua LUAL=/usr/local/lib/lua |
33 | ``` | 34 | ``` |
34 | 35 | ||
35 |   Then get the binary file from path `bin/shared/moonp.so`. | 36 |   Then get the binary file from path `bin/shared/yue.so`. |
36 | 37 | ||
37 |   Or you can install [luarocks](https://luarocks.org), a package manager for Lua modules. Then install it as a Lua module with | 38 |   Or you can install [luarocks](https://luarocks.org), a package manager for Lua modules. Then install it as a Lua module with |
38 | 39 | ||
39 | ```sh | 40 | ```sh |
40 | > luarocks install moonplus | 41 | > luarocks install yuescript |
41 | ``` | 42 | ``` |
42 | 43 | ||
43 |   Then require the MoonPlus module in Lua: | 44 |   Then require the Yuescript module in Lua: |
44 | 45 | ||
45 | ```Lua | 46 | ```Lua |
46 | require("moonp")("main") -- require `main.mp` | 47 | require("yue")("main") -- require `main.yue` |
47 | 48 | ||
48 | local moonp = require("moonp") | 49 | local yue = require("yue") |
49 | local codes, err, globals = moonp.to_lua([[ | 50 | local codes, err, globals = yue.to_lua([[ |
50 | f = -> | 51 | f = -> |
51 | print "hello world" | 52 | print "hello world" |
52 | f! | 53 | f! |
@@ -66,21 +67,21 @@ f! | |||
66 | > make install | 67 | > make install |
67 | ``` | 68 | ``` |
68 | 69 | ||
69 |   Build MoonPlus tool without macro feature: | 70 |   Build Yuescript tool without macro feature: |
70 | ```sh | 71 | ```sh |
71 | > make install NO_MACRO=true | 72 | > make install NO_MACRO=true |
72 | ``` | 73 | ``` |
73 | 74 | ||
74 |   Build MoonPlus tool without built-in Lua binary: | 75 |   Build Yuescript tool without built-in Lua binary: |
75 | ```sh | 76 | ```sh |
76 | > make install NO_LUA=true | 77 | > make install NO_LUA=true |
77 | ``` | 78 | ``` |
78 | 79 | ||
79 |   Use MoonPlus tool with: | 80 |   Use Yuescript tool with: |
80 | 81 | ||
81 | ```sh | 82 | ```sh |
82 | > moonp -h | 83 | > yue -h |
83 | Usage: moonp [options|files|directories] ... | 84 | Usage: yue [options|files|directories] ... |
84 | 85 | ||
85 | -h Print this message | 86 | -h Print this message |
86 | -e str Execute a file or raw codes | 87 | -e str Execute a file or raw codes |
@@ -99,30 +100,18 @@ Usage: moonp [options|files|directories] ... | |||
99 | in a single line to start/stop multi-line mode | 100 | in a single line to start/stop multi-line mode |
100 | ``` | 101 | ``` |
101 |   Use cases: | 102 |   Use cases: |
102 |   Recursively compile every moon+ file with extension `.mp` under current path: `moonp .` | 103 |   Recursively compile every Yuescript file with extension `.yue` under current path: `yue .` |
103 |   Compile and save results to a target path: `moonp -t /target/path/ .` | 104 |   Compile and save results to a target path: `yue -t /target/path/ .` |
104 |   Compile and reserve debug info: `moonp -l .` | 105 |   Compile and reserve debug info: `yue -l .` |
105 |   Compile and generate minified codes: `moonp -m .` | 106 |   Compile and generate minified codes: `yue -m .` |
106 |   Execute raw codes: `moonp -e 'print 123'` | 107 |   Execute raw codes: `yue -e 'print 123'` |
107 |   Execute a moon+ file: `moonp -e main.mp` | 108 |   Execute a Yuescript file: `yue -e main.yue` |
108 | 109 | ||
109 | 110 | ||
110 | 111 | ||
111 | * **Docker Hub** | ||
112 | Try moonp in another easy way: https://hub.docker.com/r/moonplus/moonplus. | ||
113 | ```bash | ||
114 | docker run -it moonplus/moonplus:0.4.19 | ||
115 | ``` | ||
116 | |||
117 | The REPL console should be ready, | ||
118 | ```bash | ||
119 | Moonscript+ 0.4.19 | ||
120 | > | ||
121 | ``` | ||
122 | |||
123 | ## Editor Support | 112 | ## Editor Support |
124 | 113 | ||
125 | * [Vim](https://github.com/pigpigyyy/MoonPlus-vim) | 114 | * [Vim](https://github.com/pigpigyyy/Yuescript-vim) |
126 | 115 | ||
127 | 116 | ||
128 | 117 | ||