Yuescript는 MoonScript 방언입니다. Moonscript Language 0.5.0에서 파생되었으며 새로운 기능을 지속적으로 채택하여 최신 정보를 제공합니다.
Moonscript는 Lua에 컴파일하는 언어입니다. 원래 Moonscript는 웹 프레임 워크 Lapis를 작성하고 itch.io 및 Streak.club과 같은 몇 가지 비즈니스 웹 사이트를 실행하는 데 사용되었으므로 일부 대형 코드베이스가 있습니다. 원래 언어는 기존 응용 프로그램의 안정성을 깨뜨릴 수있는 새로운 기능을 채택하기가 너무 어려워지고 있습니다.
따라서 Yuescript는 언어를 추진하고 새로운 언어 구문을 소개하거나 Moonscript 언어를보다 표현적이고 생산적으로 만들기 위해 놀이터가되는 새로운 코드 기반입니다.
Yue (is)는 중국어의 달의 이름이며 [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 Binary없이 Yuescript 도구를 빌드하십시오.
> make install NO_LUA=trueYuescript 도구를 사용하십시오.
> 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 파일을 Extension .yue 로 현재 경로에서 재귀 적으로 컴파일합니다. yue .
목표 경로로 결과를 컴파일하고 저장하십시오 : yue -t /target/path/ .
디버그 정보를 컴파일하고 예약하십시오. yue -l .
최소화 된 코드를 컴파일하고 생성하십시오 : yue -m .
원시 코드 실행 : yue -e 'print 123'
Yuescript 파일을 실행합니다 : yue -e main.yue
MIT