All Projects → pigpigyyy → Yuescript

pigpigyyy / Yuescript

Licence: MIT License
A Moonscript dialect compiles to Lua.

Programming Languages

C++
36643 projects - #6 most used programming language
lua
6591 projects
c
50402 projects - #5 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to Yuescript

Moonscript
🌙 A language that compiles to Lua
Stars: ✭ 2,694 (+1466.28%)
Mutual labels:  moonscript, transpiler
go2hx
Go -> Haxe -> JS Java C# C++ C Python Lua
Stars: ✭ 49 (-71.51%)
Mutual labels:  transpiler
ShenScript
Shen for JavaScript
Stars: ✭ 40 (-76.74%)
Mutual labels:  transpiler
qaffeine
Decaffeinate your JS-powered CSS stylesheets
Stars: ✭ 22 (-87.21%)
Mutual labels:  transpiler
nvim-moonmaker
Moonscript plugin support for neovim
Stars: ✭ 55 (-68.02%)
Mutual labels:  moonscript
sqlglot
Python SQL Parser and Transpiler
Stars: ✭ 310 (+80.23%)
Mutual labels:  transpiler
json-sql-builder2
Level Up Your SQL-Queries
Stars: ✭ 59 (-65.7%)
Mutual labels:  transpiler
go2cpp
Go to C++20 transpiler
Stars: ✭ 51 (-70.35%)
Mutual labels:  transpiler
BashClass
BashClass is an Object Oriented Programming language that compiles to BASH 4.4
Stars: ✭ 40 (-76.74%)
Mutual labels:  transpiler
bck2brwsr
Bck2Brwsr VM to transpile Java bytecode to JavaScript
Stars: ✭ 93 (-45.93%)
Mutual labels:  transpiler
js-slang
Implementations of the Source languages, which are small sublanguages of JavaScript designed for SICP JS
Stars: ✭ 41 (-76.16%)
Mutual labels:  transpiler
ijitsuki
Aegisub 3+ moonscript macros
Stars: ✭ 19 (-88.95%)
Mutual labels:  moonscript
grizzly
A Python-to-SQL transpiler as replacement for Python Pandas
Stars: ✭ 27 (-84.3%)
Mutual labels:  transpiler
sugartex
SugarTeX is a more readable LaTeX language extension and transcompiler to LaTeX. Fast Unicode autocomplete in Atom editor via https://github.com/kiwi0fruit/atom-sugartex-completions
Stars: ✭ 74 (-56.98%)
Mutual labels:  transpiler
Go2SourcePawn
Go2SourcePawn is a transpiler that transforms a subset of Golang-like code to equivalent SourcePawn.
Stars: ✭ 13 (-92.44%)
Mutual labels:  transpiler
go-mlog
Go to Mindustry (MLOG) compiler, runtime and decompiler (WIP)
Stars: ✭ 19 (-88.95%)
Mutual labels:  transpiler
Headache
Programming Language that compiles to 8 Bit Brainfuck
Stars: ✭ 59 (-65.7%)
Mutual labels:  transpiler
alive
experimental livecoding environment with persistent expressions
Stars: ✭ 29 (-83.14%)
Mutual labels:  moonscript
grumpy
Grumpy is a Python to Go source code transcompiler and runtime.
Stars: ✭ 378 (+119.77%)
Mutual labels:  transpiler
razcal
Build cross platform desktop app with Lua, MoonScript, and Layout Language
Stars: ✭ 15 (-91.28%)
Mutual labels:  moonscript

YueScript

logo

Ubuntu Windows macOS discord

Yuescript is a Moonscript dialect. It is derived from Moonscript language 0.5.0 and continuously adopting new features to be more up to date.

Moonscript is a language that compiles to Lua. Since original Moonscript has been used to write web framework lapis and run a few business web sites like itch.io and streak.club with some large code bases. The original language is getting too hard to adopt new features for those may break the stablility for existing applications.

So Yuescript is a new code base for pushing the language to go forward and being a playground to try introducing new language syntax or programing paradigms to make Moonscript language more expressive and productive.

Yue (月) is the name of moon in Chinese and it's pronounced as [jyɛ].

Features

  • No other dependencies needed except modified parserlib library from Achilleas Margaritis with some performance enhancement. lpeg library is no longer needed.
  • Written in C++17.
  • Support most of the features from Moonscript language. Generate Lua codes in the same way like the original compiler.
  • Reserve line numbers from source file in the compiled Lua codes to help debugging.
  • More features like macro, existential operator, pipe operator, Javascript-like export syntax and etc.
  • See other details in the changelog. Find document here.

Installation & Usage

  • Lua Module

  Build yue.so file with

> make shared LUAI=/usr/local/include/lua LUAL=/usr/local/lib/lua

  Then get the binary file from path bin/shared/yue.so.

  Or you can install luarocks, a package manager for Lua modules. Then install it as a Lua module with

> luarocks install yuescript

  Then require the Yuescript module in Lua:

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
})
  • Binary Tool

  Clone this repo, then build and install executable with:

> make install

  Build Yuescript tool without macro feature:

> make install NO_MACRO=true

  Build Yuescript tool without built-in Lua binary:

> make install NO_LUA=true

  Use Yuescript tool with:

> yue -h
Usage: yue [options|files|directories] ...

   -h       Print this message
   -e str   Execute a file or raw codes
   -t path  Specify where to place compiled files
   -o file  Write output to file
   -s       Use spaces in generated codes instead of tabs
   -m       Generate minified codes
   -p       Write output to standard out
   -b       Dump compile time (doesn't write output)
   -l       Write line numbers from source codes
   -v       Print version
   --       Read from standard in, print to standard out
            (Must be first and only argument)

   Execute without options to enter REPL, type symbol '$'
   in a single line to start/stop multi-line mode

  Use cases:
  Recursively compile every Yuescript file with extension .yue under current path: yue .
  Compile and save results to a target path: yue -t /target/path/ .
  Compile and reserve debug info: yue -l .
  Compile and generate minified codes: yue -m .
  Execute raw codes: yue -e 'print 123'
  Execute a Yuescript file: yue -e main.yue

Editor Support

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].