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
麻省理工学院