Yuescript هي لهجة Moonscript. وهي مشتقة من لغة Moonscript 0.5.0 وتبني ميزات جديدة بشكل مستمر لتكون أكثر حتى الآن.
Moonscript هي لغة تجمعها لوا. منذ أن تم استخدام Moonscript الأصلي لكتابة لا لابيس الإطار على الويب وتشغيل عدد قليل من مواقع الويب التجارية مثل itch.io و streak.club مع بعض قواعد التعليمات البرمجية الكبيرة. من الصعب للغاية تبني اللغة الأصلية لميزات جديدة لأولئك الذين قد يكسرون التنقل للتطبيقات الحالية.
لذا فإن Yuescript هي قاعدة رمز جديدة لدفع اللغة للمضي قدمًا وكونها ملعبًا لمحاولة تقديم بناء جملة لغة جديدة أو نماذج برمجة لجعل لغة Moonscript أكثر تعبيرية وإنتاجية.
Yue (月) هو اسم القمر باللغة الصينية ويتم نطقه باسم [jyɛ].
بناء ملف yue.so
> make shared LUAI=/usr/local/include/lua LUAL=/usr/local/lib/lua ثم احصل على الملف الثنائي من Path bin/shared/yue.so .
أو يمكنك تثبيت Luarocks ، مدير الحزمة لوحدات LUA. ثم تثبيته كوحدة LUA مع
> luarocks install yuescriptثم طلب وحدة 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=trueBuild Yuescript Tool بدون Binary Lua Binary المدمج:
> make install NO_LUA=trueاستخدم أداة 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 حالات الاستخدام:
قم yue . كل ملف yuescript بشكل متكرر مع الامتداد .yue
تجميع وحفظ النتائج إلى مسار مستهدف: yue -t /target/path/ .
ترجمة والاحتياطي معلومات تصحيح: yue -l .
تجميع وإنشاء رموز مصغرة: yue -m .
تنفيذ الرموز الخام: yue -e 'print 123'
تنفيذ ملف yuescript: yue -e main.yue
معهد ماساتشوستس للتكنولوجيا