Yuescriptは測定値の方言です。これは、ムーンスクリプト言語0.5.0から派生しており、新しい機能を継続的に採用して、より最新の状態にしています。
ムーンスクリプトは、ルアにコンパイルする言語です。 Original Moonscriptは、WebフレームワークLapisを作成し、いくつかの大きなコードベースを備えたitch.ioやStreak.clubなどのいくつかのビジネスWebサイトを実行するために使用されているためです。元の言語は、それらのために新しい機能を採用するのが難しくなっています。
したがって、Yuescriptは、言語を前進させるようにプッシュし、新しい言語の構文やプログラミングパラダイムを導入して、ムーンスクリプト言語をより表現力豊かで生産的にするための遊び場であるための新しいコードベースです。
ユエ(月)は中国語の月の名前であり、それは[jyɛ]と発音されます。
yue.soファイルを作成します
> make shared LUAI=/usr/local/include/lua LUAL=/usr/local/lib/lua次に、Path 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=truewith:with yuescriptツールを使用してください。
> 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
mit