aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md299
-rw-r--r--README.md85
2 files changed, 346 insertions, 38 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d22e644..ba91bbb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,305 @@
2 2
3The implementation for the original Moonscript language 0.5.0 can be found in the `0.5.0` branch of Yuescript. The Moonscript with fixes and new features is in the main branch of Yuescript. Here are the changelogs for each Yuescript version. 3The implementation for the original Moonscript language 0.5.0 can be found in the `0.5.0` branch of Yuescript. The Moonscript with fixes and new features is in the main branch of Yuescript. Here are the changelogs for each Yuescript version.
4 4
5## v0.33.x
6
7### Added Features
8
9* Expanded documentation deliverables with an all-in-one documentation output.
10* Improved `break` feature set by supporting multiple break values (extends the `break with value` work introduced in `v0.28.x`).
11* Further improved reserved-comment preservation behavior for table/class blocks (parser, AST and code generation), with dedicated test coverage.
12
13### Fixed Issues
14
15* Fixed formatter issues and improved formatting stability.
16* Fixed comma placement/insertion issues when line-number comments are enabled (including class-member cases, issue #240).
17* Fixed more comment-preserving code paths and issue #245.
18* Improved documentation site rendering/highlighting and updated documentation content/assets.
19
20## v0.32.x
21
22### Added Features
23
24* Added `;` as a statement separator.
25 ```moonscript
26 a = 1; b = 2; result = a + b
27 ```
28* Migrated the documentation site to VitePress and added/expanded localized docs (including German and Portuguese-Brazil).
29* Added substantial compiler test coverage (including large regression/spec batches).
30
31### Fixed Issues
32
33* Fixed `import global` related issues after the `v0.31.x` syntax addition.
34* Fixed global-variable lint behavior.
35* Improved cross-platform build support (LuaJIT, MSVC/Windows, CMake, rockspec updates).
36* Added Lua 5.5 support in CMake configuration and fixed CI/build workflow issues.
37* Fixed issue #227 and multiple documentation/site regressions.
38
39## v0.31.x
40
41### Added Features
42
43* Added const attributes.
44 ```moonscript
45 const a = 123
46 const {:x, :y} = point
47 ```
48* Added `import global` syntax.
49 ```moonscript
50 import global
51 print "hello"
52 math.random 10
53 ```
54* These are the primary language-level additions in `v0.31.x` (with follow-up fixes landing in `v0.32.x`).
55
56### Fixed Issues
57
58* Fixed global import ordering.
59* Fixed a crash issue in `v0.31.1`.
60* Updated Windows workflow/build-related integration.
61
62## v0.30.x
63
64### Added Features
65
66* Added named vararg support.
67 ```moonscript
68 f = (...t) ->
69 for i = 1, t.n
70 print t[i]
71 ```
72* Improved syntax error messages with more contextual details (not syntax-changing, but a meaningful compiler UX improvement).
73
74### Fixed Issues
75
76* Fixed empty-line-as-block parsing issue.
77* Fixed formatter crash and other formatting-related issues.
78* Refactored `FnArgsDef` rules and fixed issue #224.
79* Updated reserved-comments behavior/functionality.
80
81## v0.29.x
82
83### Added Features
84
85* Introduced/iterated new syntax around `try` flow, including `try!` / `try?` related changes.
86 ```moonscript
87 a, b, c = try? func!
88 a = (try? func!) ?? "default"
89
90 f try?
91 print 123
92 func!
93 catch e
94 print e
95 e
96 ```
97* Added more reversed-index support for slice expressions and later fixed reversed-index edge cases.
98 ```moonscript
99 tab = [1, 2, 3, 4, 5]
100 print tab[#], tab[#-1]
101 ```
102* Added function argument destructuring.
103 ```moonscript
104 f = ({:x, :y}) -> x + y
105 print f x: 1, y: 2
106 ```
107* Added YAML multiline string support and macro argument checking.
108 ```moonscript
109 config = |
110 database:
111 host: localhost
112 port: 5432
113 ```
114
115### Fixed Issues
116
117* Fixed a crash in `yue.to_ast()` and additional reference/crash issues.
118* Stopped linting explicitly defined global variables.
119* Fixed issue #222 and #223.
120* Improved platform/build compatibility: Windows x64, Lua 5.1, Termux, WASM/build pipeline issues.
121* Renamed builtin JSON library to `cojson`, included a minimal JSON lib in the compiler tool, and removed `codecvt` usage for C++26 compatibility.
122
123## v0.28.x
124
125### Added Features
126
127* Allowed backcall without parentheses.
128 ```moonscript
129 results = do
130 data <- readAsync "data.txt"
131 process data
132 ```
133* Added global `const` declaration support, including declaration without initializer.
134 ```moonscript
135 import global
136 global const Flag = 1
137 global const math, table
138 ```
139* Added `break with value` syntax.
140 ```moonscript
141 x, y = for i = 1, 10
142 if i > 5
143 break i, i * 2
144 ```
145* Added `-` for implicit object.
146 ```moonscript
147 items =
148 - "a"
149 - "b"
150 - "c"
151 ```
152
153### Fixed Issues
154
155* Added/expanded related tests/docs and table-matching support around the new syntax behaviors.
156
157## v0.27.x
158
159### Added Features
160
161* Adjusted macro behavior by aligning Lua inserter macro behavior with common Yue macro behavior (semantic behavior alignment rather than new syntax).
162
163### Fixed Issues
164
165* Fixed issues #194, #195, #198, #201, #204, #206 and #209.
166* Updated `efsw` and fixed build-related issues.
167* Added/updated tests and documentation examples.
168
169## v0.26.x
170
171### Added Features
172
173* Added WASM distribution support for ESM/CommonJS modules and TypeScript integration (#176).
174
175### Fixed Issues
176
177* Fixed WASM build issues and updated WASM build pipeline.
178* Fixed issues #174, #175, #177, #178, #183, #185 and #188.
179* Fixed MoonScript issue #459.
180* Fixed build flags and related release/build issues; refreshed specs/docs/readme.
181
182## v0.25.x
183
184### Added Features
185
186* This series mainly improves semantic correctness and code generation consistency.
187
188### Fixed Issues
189
190* Fixed multi-value assignment evaluation order (including more edge cases in `v0.25.1`).
191* Disallowed some semantically incorrect syntax to improve code consistency.
192* Removed redundant/useless `do` blocks in generated code (`with` and related cases).
193* Fixed indentation/missed-indent issue and a few additional regressions.
194
195## v0.24.x
196
197### Added Features
198
199* Added reusable macro environment support.
200* Added builtin macros `$to_ast()` and `$is_ast()`.
201* Added `yue.is_ast()`.
202 ```moonscript
203 import "yue"
204 formated = yue.format code, 0, true
205 ```
206
207### Fixed Issues
208
209* Fixed macro function line-number handling.
210* Fixed Lua 5.1 build.
211* Fixed Lua stack size insufficiency issue.
212
213## v0.23.x
214
215### Added Features
216
217* Added macros-generating-macros feature (`v0.23.9`), expanding macro metaprogramming capability.
218 ```moonscript
219 macro Enum = (...) ->
220 items = {...}
221 itemSet = {item, true for item in *items}
222 (item) ->
223 error "got \"#{item}\", expecting one of #{table.concat items, ', '}" unless itemSet[item]
224 "\"#{item}\""
225
226 macro BodyType = $Enum(
227 Static
228 Dynamic
229 Kinematic
230 )
231
232 print "Valid enum type:", $BodyType Static
233 ```
234* Most other `v0.23.x` changes focus on try-catch/code-generation correctness rather than new syntax forms.
235* Added more tests/spec cases and documentation updates (including object literal docs in README, #165).
236
237### Fixed Issues
238
239* Fixed multiple try-catch syntax ambiguity/corner cases and removed redundant generated `do` blocks.
240* Fixed spread expression list issue in up-value functions.
241* Prevented extra anonymous function generation from `const`/`close` declarations.
242* Fixed nil-coalescing/anonymous-function movement issue and anonymous-function argument ordering.
243* Fixed a for-each key variable const-marking issue and traceback rewrite/codegen checks.
244
245## v0.22.x
246
247### Added Features
248
249* Added default return declaration for function literals.
250 ```moonscript
251 findValue = (items): "not found" ->
252 for item in *items
253 if item.name == "target"
254 return item.name
255 ```
256* Added option to stop implicit returns on the root (#164).
257* `v0.22.x` also adjusts `for`-loop const behavior to align with Lua 5.5 changes, then refines the rule in `v0.22.1` (only index/key variable is const).
258
259### Fixed Issues
260
261* Fixed undeclared specifier in `yue_compiler.cpp` (#163).
262* Removed an unnecessary const declaration.
263* Corrected/refined `for`-loop const default behavior introduced in `v0.22.0`.
264
265## v0.21.x
266
267### Added Features
268
269* Changed the if-assignment syntax to prevent error-prone cases (syntax/grammar behavior change).
270 ```moonscript
271 if user := obj\find_user "valid"
272 print user.name
273 elseif other := obj\find_user "fallback"
274 print other.name
275 ```
276* Added `yue.format()` and fixed `yue` AST-to-code conversion related functionality.
277 ```moonscript
278 import "yue"
279 formated = yue.format code, 0, true
280 ```
281
282### Fixed Issues
283
284* Fixed issues #157 and #158 (including a web compiler issue).
285* Fixed invalid formatting/formation cases and in-expression formatting issues.
286* Fixed more invalid in-expression use cases.
287* Fixed const list destructuring, empty-check/empty-block-at-EOF cases, and crash/format edge cases.
288* Fixed `luaminify` related issue and updated Lua 5.4 integration/tooling.
289
290## v0.20.x (after v0.20.2)
291
292### Added Features
293
294* This interval mainly contains follow-up fixes for newly introduced `v0.20.2` features (chaining conditions, list/switch matching, import handling) plus release pipeline improvements.
295
296### Fixed Issues
297
298* Fixed table-matching syntax in `switch` statements with list tables.
299* Fixed a missing condition-chaining case.
300* Fixed a crash case for `import` statements.
301* Made function-call argument behavior consistent with table-list behavior.
302* Improved release/build pipeline setup (CI workflows, LuaRocks upload, docs code checks, test workflow setup).
303
5## v0.20.2 304## v0.20.2
6 305
7### Added Features 306### Added Features
diff --git a/README.md b/README.md
index 73fadf7..caff885 100644
--- a/README.md
+++ b/README.md
@@ -1,55 +1,58 @@
1# YueScript 1# YueScript
2 2
3<img src="doc/docs/.vitepress/public/image/yuescript.png" width="300" height="300" alt="logo"/> 3<img src="doc/docs/.vitepress/public/image/yuescript.png" width="300" height="300" alt="YueScript logo"/>
4 4
5[![IppClub](https://img.shields.io/badge/IppClub-Certified-11A7E2?logo=data%3Aimage%2Fsvg%2Bxml%3Bcharset%3Dutf-8%3Bbase64%2CPHN2ZyB2aWV3Qm94PSIwIDAgMjg4IDI3NCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWw6c3BhY2U9InByZXNlcnZlIiBzdHlsZT0iZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO3N0cm9rZS1taXRlcmxpbWl0OjIiPjxwYXRoIGQ9Im0xNDYgMzEgNzIgNTVWMzFoLTcyWiIgc3R5bGU9ImZpbGw6I2Y2YTgwNjtmaWxsLXJ1bGU6bm9uemVybyIvPjxwYXRoIGQ9Im0xNjkgODYtMjMtNTUgNzIgNTVoLTQ5WiIgc3R5bGU9ImZpbGw6I2VmN2EwMDtmaWxsLXJ1bGU6bm9uemVybyIvPjxwYXRoIGQ9Ik0yNiAzMXY1NWg4MEw4MSAzMUgyNloiIHN0eWxlPSJmaWxsOiMwN2ExN2M7ZmlsbC1ydWxlOm5vbnplcm8iLz48cGF0aCBkPSJNMTA4IDkydjExMmwzMS00OC0zM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BzdHlsZT0iZmlsbDojNGUyNzVhO2ZpbGwtcnVsZTpub256ZXJvIi8%2BPHBhdGggZD0ibTEwNiA2MCA0MS0xLTIzIDQxLTE4LTQwWiIgc3R5bGU9ImZpbGw6IzdiMTI4NTtmaWxsLXJ1bGU6bm9uemVybyIvPjxwYXRoIGQ9Im0xMDggMjA0IDMxLTQ4aC0zMXY0OFoiIHN0eWxlPSJmaWxsOiNiYTAwNzc7ZmlsbC1ydWxlOm5vbnplcm8iLz48cGF0aCBkPSJtNjUgMjc0IDMzLTUySDBsNjUgNTJaIiBzdHlsZT0iZmlsbDojZWY3YTAwO2ZpbGwtcnVsZTpub256ZXJvIi8%2BPHBhdGggZD0iTTc3IDI3NGg2N2wtNDAtNDUtMjcgNDVaIiBzdHlsZT0iZmlsbDojYTgxZTI0O2ZpbGwtcnVsZTpub256ZXJvIi8%2BPHBhdGggZD0iTTE2NyAyMjJoNThsLTM0IDUyLTI0LTUyWiIgc3R5bGU9ImZpbGw6IzExYTdlMjtmaWxsLXJ1bGU6bm9uemVybyIvPjxwYXRoIGQ9Im0yNzAgMjc0LTQ0LTUyLTM1IDUyaDc5WiIgc3R5bGU9ImZpbGw6IzA1N2NiNztmaWxsLXJ1bGU6bm9uemVybyIvPjxwYXRoIGQ9Ik0yNzUgNTVoLTU3VjBoMjV2MzFoMzJ2MjRaIiBzdHlsZT0iZmlsbDojZGUwMDVkO2ZpbGwtcnVsZTpub256ZXJvIi8%2BPHBhdGggZD0iTTE4NSAzMWg1N3Y1NWgtMjVWNTVoLTMyVjMxWiIgc3R5bGU9ImZpbGw6I2M1MTgxZjtmaWxsLXJ1bGU6bm9uemVybyIvPjwvc3ZnPg%3D%3D&labelColor=fff)](https://ippclub.org) [![Ubuntu](https://github.com/pigpigyyy/Yuescript/actions/workflows/ubuntu.yml/badge.svg)](https://github.com/pigpigyyy/Yuescript/actions/workflows/ubuntu.yml) [![Windows](https://github.com/pigpigyyy/Yuescript/actions/workflows/windows.yml/badge.svg)](https://github.com/pigpigyyy/Yuescript/actions/workflows/windows.yml) [![macOS](https://github.com/pigpigyyy/Yuescript/actions/workflows/macos.yml/badge.svg)](https://github.com/pigpigyyy/Yuescript/actions/workflows/macos.yml) [![Discord Badge](https://img.shields.io/discord/844031511208001577?color=5865F2&label=Discord&logo=discord&logoColor=white&style=flat-square)](https://discord.gg/cRJ2VAm2NV) 5[![IppClub](https://img.shields.io/badge/IppClub-Certified-11A7E2?logo=data%3Aimage%2Fsvg%2Bxml%3Bcharset%3Dutf-8%3Bbase64%2CPHN2ZyB2aWV3Qm94PSIwIDAgMjg4IDI3NCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWw6c3BhY2U9InByZXNlcnZlIiBzdHlsZT0iZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO3N0cm9rZS1taXRlcmxpbWl0OjIiPjxwYXRoIGQ9Im0xNDYgMzEgNzIgNTVWMzFoLTcyWiIgc3R5bGU9ImZpbGw6I2Y2YTgwNjtmaWxsLXJ1bGU6bm9uemVybyIvPjxwYXRoIGQ9Im0xNjkgODYtMjMtNTUgNzIgNTVoLTQ5WiIgc3R5bGU9ImZpbGw6I2VmN2EwMDtmaWxsLXJ1bGU6bm9uemVybyIvPjxwYXRoIGQ9Ik0yNiAzMXY1NWg4MEw4MSAzMUgyNloiIHN0eWxlPSJmaWxsOiMwN2ExN2M7ZmlsbC1ydWxlOm5vbnplcm8iLz48cGF0aCBkPSJNMTA4IDkydjExMmwzMS00OC0zMS02NFoiIHN0eWxlPSJmaWxsOiNkZTAwNWQ7ZmlsbC1ydWxlOm5vbnplcm8iLz48cGF0aCBkPSJNMCAyNzR2LTUyaDk3bC0zMyA1MkgwWiIgc3R5bGU9ImZpbGw6I2Y2YTgwNjtmaWxsLXJ1bGU6bm9uemVybyIvPjxwYXRoIGQ9Im03NyAyNzQgNjctMTA3djE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Y0OFoiIHN0eWxlPSJmaWxsOiNiYTAwNzc7ZmlsbC1ydWxlOm5vbnplcm8iLz48cGF0aCBkPSJtNjUgMjc0IDMzLTUySDBsNjUgNTJaIiBzdHlsZT0iZmlsbDojZWY3YTAwO2ZpbGwtcnVsZTpub256ZXJvIi8%2BPHBhdGggZD0iTTc3IDI3NGg2N2wtNDAtNDUtMjcgNDVaIiBzdHlsZT0iZmlsbDojYTgxZTI0O2ZpbGwtcnVsZTpub256ZXJvIi8%2BPHBhdGggZD0iTTE2NyAyMjJoNThsLTM0IDUyLTI0LTUyWiIgc3R5bGU9ImZpbGw6IzExYTdlMjtmaWxsLXJ1bGU6bm9uemVybyIvPjxwYXRoIGQ9Im0yNzAgMjc0LTQ0LTUyLTM1IDUyaDc5WiIgc3R5bGU9ImZpbGw6IzA1N2NiNztmaWxsLXJ1bGU6bm9uemVybyIvPjxwYXRoIGQ9Ik0yNzUgNTVoLTU3VjBoMjV2MzFoMzJ2MjRaIiBzdHlsZT0iZmlsbDojZGUwMDVkO2ZpbGwtcnVsZTpub256ZXJvIi8%2BPHBhdGggZD0iTTE4NSAzMWg1N3Y1NWgtMjVWNTVoLTMyVjMxWiIgc3R5bGU9ImZpbGw6I2M1MTgxZjtmaWxsLXJ1bGU6bm9uemVybyIvPjwvc3ZnPg%3D%3D&labelColor=fff)](https://ippclub.org) [![Ubuntu](https://github.com/pigpigyyy/Yuescript/actions/workflows/ubuntu.yml/badge.svg)](https://github.com/pigpigyyy/Yuescript/actions/workflows/ubuntu.yml) [![Windows](https://github.com/pigpigyyy/Yuescript/actions/workflows/windows.yml/badge.svg)](https://github.com/pigpigyyy/Yuescript/actions/workflows/windows.yml) [![macOS](https://github.com/pigpigyyy/Yuescript/actions/workflows/macos.yml/badge.svg)](https://github.com/pigpigyyy/Yuescript/actions/workflows/macos.yml) [![Discord Badge](https://img.shields.io/discord/844031511208001577?color=5865F2&label=Discord&logo=discord&logoColor=white&style=flat-square)](https://discord.gg/cRJ2VAm2NV)
6 6
7YueScript 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. 7YueScript is a MoonScript dialect that compiles to Lua. It is derived from [MoonScript](https://github.com/leafo/moonscript) `0.5.0` and continues to adopt new features to stay up to date.
8 8
9MoonScript 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. 9## Quick Links
10 10
11So 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. 11- Website: <https://yuescript.org>
12- Documentation: <https://yuescript.org/doc>
13- Changelog: [`CHANGELOG.md`](./CHANGELOG.md)
14- Discord: <https://discord.gg/cRJ2VAm2NV>
12 15
13Yue (月) is the name of moon in Chinese and it's pronounced as [jyɛ]. 16## Overview
14 17
18MoonScript has been used to build real-world projects such as [Lapis](https://github.com/leafo/lapis), [itch.io](https://itch.io), and [streak.club](https://streak.club). As the original implementation became harder to evolve without risking compatibility, YueScript was created as a modernized code base for pushing the language forward.
15 19
20YueScript is both a production-ready compiler and a playground for exploring new syntax and programming paradigms that make MoonScript-style development more expressive and productive.
21
22Yue (月) is the Chinese word for moon and is pronounced [jyɛ].
16 23
17## About Dora SSR 24## About Dora SSR
18 25
19YueScript is being developed and maintained alongside the open-source game engine [Dora SSR](https://github.com/ippclub/Dora-SSR). It has been used to create engine tools, game demos and prototypes, validating its capabilities in real-world scenarios while enhancing the Dora SSR development experience. 26YueScript is being developed and maintained alongside the open-source game engine [Dora SSR](https://github.com/ippclub/Dora-SSR). It has been used to create engine tools, game demos and prototypes, validating its capabilities in real-world scenarios while enhancing the Dora SSR development experience.
20 27
21
22
23## Features 28## Features
24 29
25* Based on modified [parserlib](https://github.com/axilmar/parserlib) library from Achilleas Margaritis with some performance enhancement. **lpeg** library is no longer needed. 30- Based on a modified [parserlib](https://github.com/axilmar/parserlib) with performance enhancements. `lpeg` is no longer required.
26* Written in C++17. 31- Written in C++17.
27* Support most of the features from MoonScript language. Generate Lua codes in the same way like the original compiler. 32- Supports most MoonScript features and generates Lua code in a style compatible with the original compiler.
28* Reserve line numbers from source file in the compiled Lua codes to help debugging. 33- Preserves source line numbers in generated Lua to improve debugging.
29* More features like macro, existential operator, pipe operator, Javascript-like export syntax and etc. 34- Adds features like macros, existential operator, pipe operator, JavaScript-like export syntax, and more.
30* See other details in the [changelog](./CHANGELOG.md). Find document [here](http://yuescript.org). 35- See [`CHANGELOG.md`](./CHANGELOG.md) for more details.
31
32
33 36
34## Installation & Usage 37## Installation
35 38
36* **Lua Module** 39### Lua Module
37 40
38&emsp;&emsp;Build `yue.so` file with 41Build `yue.so` with:
39 42
40```sh 43```sh
41> make shared LUAI=/usr/local/include/lua LUAL=/usr/local/lib/lua 44> make shared LUAI=/usr/local/include/lua LUAL=/usr/local/lib/lua
42``` 45```
43 46
44&emsp;&emsp;Then get the binary file from path `bin/shared/yue.so`. 47Then get the binary file from `bin/shared/yue.so`.
45 48
46&emsp;&emsp;Or you can install [luarocks](https://luarocks.org), a package manager for Lua modules. Then install it as a Lua module with 49Or install via [LuaRocks](https://luarocks.org):
47 50
48```sh 51```sh
49> luarocks install yuescript 52> luarocks install yuescript
50``` 53```
51 54
52&emsp;&emsp;Then require the YueScript module in Lua: 55Then require the YueScript module in Lua:
53 56
54```lua 57```lua
55require("yue")("main") -- require `main.yue` 58require("yue")("main") -- require `main.yue`
@@ -65,26 +68,27 @@ f!
65}) 68})
66``` 69```
67 70
71### Binary Tool (CLI)
68 72
73Clone this repo, then build and install executable with:
69 74
70* **Binary Tool**
71
72&emsp;&emsp;Clone this repo, then build and install executable with:
73```sh 75```sh
74> make install 76> make install
75``` 77```
76 78
77&emsp;&emsp;Build YueScript tool without macro feature: 79Build YueScript tool without macro feature:
80
78```sh 81```sh
79> make install NO_MACRO=true 82> make install NO_MACRO=true
80``` 83```
81 84
82&emsp;&emsp;Build YueScript tool without built-in Lua binary: 85Build YueScript tool without built-in Lua binary:
86
83```sh 87```sh
84> make install NO_LUA=true 88> make install NO_LUA=true
85``` 89```
86 90
87&emsp;&emsp;Use YueScript tool with: 91Use YueScript tool with:
88 92
89```sh 93```sh
90> yue -h 94> yue -h
@@ -131,24 +135,29 @@ Options:
131 in a single line to start/stop multi-line mode 135 in a single line to start/stop multi-line mode
132``` 136```
133 137
134Use cases: 138### Common Usage
135 139
136* Recursively compile every YueScript file with extension `.yue` under current path: `yue .` 140- Recursively compile every YueScript file with extension `.yue` under current path: `yue .`
137* Compile and save results to a target path: `yue -t /target/path/ .` 141- Compile and save results to a target path: `yue -t /target/path/ .`
138* Compile and reserve debug info: `yue -l .` 142- Compile and reserve debug info: `yue -l .`
139* Compile and generate minified codes: `yue -m .` 143- Compile and generate minified codes: `yue -m .`
140* Execute raw codes: `yue -e 'print 123'` 144- Execute raw codes: `yue -e 'print 123'`
141* Execute a YueScript file: `yue -e main.yue` 145- Execute a YueScript file: `yue -e main.yue`
142 146
147## Mascot (Xiaoyu / 小玉)
143 148
149<img src="doc/docs/.vitepress/public/image/mascot/electrichearts_20260211A_yuescript_xiaoyu.png" width="420" alt="Xiaoyu, the YueScript mascot"/>
144 150
145## Editor Support 151Xiaoyu (小玉) is YueScript's official mascot, a cyber rabbit often seen perched on a crescent moon and coding on a laptop.
146 152
147* [Vim](https://github.com/pigpigyyy/YueScript-vim) 153- English page: [here](https://yuescript.org/doc/extras/mascot.html)
148* [ZeroBraneStudio](https://github.com/pkulchenko/ZeroBraneStudio/issues/1134) (Syntax highlighting) 154- Artwork by [Tyson Tan](https://tysontan.com)
149* [Visual Studio Code](https://github.com/pigpigyyy/yuescript-vscode)
150 155
156## Editor Support
151 157
158- [Vim](https://github.com/pigpigyyy/YueScript-vim)
159- [ZeroBraneStudio](https://github.com/pkulchenko/ZeroBraneStudio/issues/1134) (Syntax highlighting)
160- [Visual Studio Code](https://github.com/pigpigyyy/yuescript-vscode)
152 161
153## License 162## License
154 163