Yuescript
v0.26.0
yuescript是一種月經的方言。它源自Moonscript語言0.5.0,並不斷採用新功能以更加最新。
Moonscript是一種將LUA編譯為LUA的語言。由於原始Moonscript已用於編寫Web Framework Lapis,並運行一些具有一些大型代碼庫的itch.io and Streak.Club等業務網站。原始語言變得太難採用新功能,可能會破壞現有應用程序的穩定性。
因此,yuescript是推動語言前進的新代碼基礎,並且是一個操場,試圖引入新的語言語法或編程範式,以使月經語言更具表現力和富有成效。
Yue(月)是中文的月亮名稱,其發音為[Jyɛ]。
yue.so
> make shared LUAI=/usr/local/include/lua LUAL=/usr/local/lib/lua然後從路徑bin/shared/yue.so中獲取二進製文件。
或者,您可以安裝Lua模塊的包裝管理器Luarocks。然後將其作為LUA模塊安裝
> luarocks install yuescript然後需要lua中的yuescript模塊:
require ( " yue " )( " main " ) -- require `main.yue`
local yue = require ( " yue " )
local codes , err , globals = yue . to_lua ( [[
f = ->
print "hello world"
f!
]] ,{
implicit_return_root = true ,
reserve_line_number = true ,
lint_global = true
})克隆此存儲庫,然後以以下方式構建和安裝可執行文件
> make install構建無宏功能的yuescript工具:
> make install NO_MACRO=true在沒有內置LUA二進制的情況下構建Yuescript工具:
> make install NO_LUA=true使用:
> yue -h
Usage: yue [options | files | directories] ...
-h Print this message
-e str Execute a file or raw codes
-m Generate minified codes
-r Rewrite output to match original line numbers
-t path Specify where to place compiled files
-o file Write output to file
-s Use spaces in generated codes instead of tabs
-p Write output to standard out
-b Dump compile time (doesn ' t write output)
-g Dump global variables used in NAME LINE COLUMN
-l Write line numbers from source codes
-c Reserve comments before statement from source codes
-w path Watch changes and compile every file under directory
-v Print version
-- Read from standard in, print to standard out
(Must be first and only argument)
--target=version Specify the Lua version that codes will be generated to
(version can only be 5.1, 5.2, 5.3 or 5.4)
--path=path_str Append an extra Lua search path string to package.path
Execute without options to enter REPL, type symbol ' $'
in a single line to start/stop multi-line mode用例:
在當前路徑下遞歸編譯每個Yuescript yue . .yue
編譯並將結果保存到目標路徑: yue -t /target/path/ .
編譯和保留調試信息: yue -l .
編譯並生成縮小的代碼: yue -m .
執行原始代碼: yue -e 'print 123'
執行yuescript文件: yue -e main.yue
麻省理工學院