IppClub/YueScript

A delightful language that compiles to Lua

Lua

617

971 commits

updated Oct 11, 2026

See the code

See what people are saying

SourceMessageScoreDate

There are languages that compile to Lua. Have you investigated those? For example, you can use a TypeScript syntax and pick up free typechecking along the way: https://typescripttolua.github.io/ There's also the venerable MoonScript: https://moonscript.org/ And YueScript, a personal fave:…

on Why I chose Lua for this blog

0

Oct 2, 2025

There are languages that transpile to Lua that get you things like typing… https://typescripttolua.github.io/ I’m personally a fan of YueScript which is basically an evolution of MoonScript (but it’s not typed). https://yuescript.org/ LuaJIT has ridiculously easy C interop.

on Lua beats MicroPython for embedded devs

0

Jul 13, 2025

I've been diving into Lua (a little late to this party, but turns out it's a perfect language to rewrite some commandline scripts I had that were getting unwieldy in Bash, especially with LLM assistance!) and it's really something of an eye-opener. LuaJITted Lua code runs at 80% (on average,…

on Teal – A statically-typed dialect of Lua

0

May 16, 2025

If I'm writing an advanced Neovim config, I'd find YueScript[0] a lot more pertinent. Personally I can't deal with Lisp paren noise, I can hardly deal with semicolons. [0]https://yuescript.org/doc/

on Why Fennel?

0

Apr 13, 2025

Yuescript https://yuescript.org

on Pluto, a Modern Lua Dialect

0

Dec 28, 2023

Yes, this is unfortunately true. There's a spiritual, mostly compatible, successor that is under active development: https://yuescript.org/

on Lua, a Misunderstood Language (2021)

0

Sep 29, 2022

Yuescript is a dynamic language that compiles to Lua

33

Jan 12, 2022

README

YueScript

YueScript logo
A delightful language that compiles to Lua
Dynamic, expressive, and concise syntax for Lua development.
Docs · Try Online · Discord

Xiaoyu, the YueScript mascot

Xiaoyu (小玉) · Official YueScript Mascot

IppClub Ubuntu Windows macOS Discord Badge

YueScript is a language that compiles to Lua. It is derived from MoonScript 0.5.0 and continues to adopt new features to stay up to date.

Overview

MoonScript has been used to build real-world projects such as Lapis, itch.io, and streak.club. MoonScript itself was also influenced by languages such as CoffeeScript. As the original implementation became harder to evolve without risking compatibility, YueScript was created as a modernized code base for pushing the language forward.

YueScript is both a production-ready compiler and a playground for exploring new syntax and programming paradigms that make Lua development more expressive and productive.

Yue (月) is the Chinese word for moon and is pronounced [jyɛ].

About Dora SSR

YueScript is being developed and maintained alongside the open-source game engine Dora SSR. It has been used to create engine tools, game demos and prototypes, validating its capabilities in real-world scenarios while enhancing the Dora SSR development experience.

Features

  • Based on a modified parserlib with performance enhancements. lpeg is no longer required.
  • Written in C++17.
  • Supports most MoonScript features and generates Lua code in a style compatible with the original compiler.
  • Preserves source line numbers in generated Lua to improve debugging.
  • Adds features like macros, existential operator, pipe operator, JavaScript-like export syntax, and more.
  • See CHANGELOG.md for more details.

Installation

Lua Module

Build yue.so with:

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

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

Or install via LuaRocks:

> 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 (CLI)

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] [<file/directory>] ...
       yue -e <code_or_file> [args...]
       yue -w [<directory>] [options]
       yue -

Notes:
   - '-' / '--' must be the first and only argument.
   - '-o/--output' can not be used with multiple input files.
   - '-w/--watch' can not be used with file input (directory only).
   - with '-e/--execute', remaining tokens are treated as script args.

Options:
   -h, --help                 Show this help message and exit.
   -e <str>, --execute <str>  Execute a file or raw codes
   -m, --minify               Generate minified codes
   -r, --rewrite              Rewrite output to match original line numbers
   -t <output_to>, --output-to <output_to>
                              Specify where to place compiled files
   -o <file>, --output <file> Write output to file
   -p, --print                Write output to standard out
   -b, --benchmark            Dump compile time (doesn't write output)
   -g, --globals              Dump global variables used in NAME LINE COLUMN
   -s, --spaces               Use spaces in generated codes instead of tabs
   -l, --line-numbers         Write line numbers from source codes
   -j, --no-implicit-return   Disable implicit return at end of file
   -c, --reserve-comments     Reserve comments before statement from source codes
   -w [<dir>], --watch [<dir>]
                              Watch changes and compile every file under directory
   -v, --version              Print version
   -                          Read from standard in, print to standard out
                              (Must be first and only argument)
   --                         Same as '-' (kept for backward compatibility)

   --target <version>         Specify the Lua version that codes will be generated to
                              (version can only be 5.1 to 5.5)
   --path <path_str>          Append an extra Lua search path string to package.path
   --<key>=<value>            Pass compiler option in key=value form (existing behavior)

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

Common Usage

  • 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

Mascot (Xiaoyu / 小玉)

Xiaoyu (小玉) is YueScript's official mascot, a cyber rabbit often seen perched on a crescent moon and coding on a laptop.

Editor Support

License

MIT

cpp
lua
moonscript
transpiler
yuescript

IppClub/YueScript

A delightful language that compiles to Lua

Lua

617

971 commits

updated Oct 11, 2026

See the code

See what people are saying

SourceMessageScoreDate

There are languages that compile to Lua. Have you investigated those? For example, you can use a TypeScript syntax and pick up free typechecking along the way: https://typescripttolua.github.io/ There's also the venerable MoonScript: https://moonscript.org/ And YueScript, a personal fave:…

on Why I chose Lua for this blog

0

Oct 2, 2025

There are languages that transpile to Lua that get you things like typing… https://typescripttolua.github.io/ I’m personally a fan of YueScript which is basically an evolution of MoonScript (but it’s not typed). https://yuescript.org/ LuaJIT has ridiculously easy C interop.

on Lua beats MicroPython for embedded devs

0

Jul 13, 2025

I've been diving into Lua (a little late to this party, but turns out it's a perfect language to rewrite some commandline scripts I had that were getting unwieldy in Bash, especially with LLM assistance!) and it's really something of an eye-opener. LuaJITted Lua code runs at 80% (on average,…

on Teal – A statically-typed dialect of Lua

0

May 16, 2025

If I'm writing an advanced Neovim config, I'd find YueScript[0] a lot more pertinent. Personally I can't deal with Lisp paren noise, I can hardly deal with semicolons. [0]https://yuescript.org/doc/

on Why Fennel?

0

Apr 13, 2025

Yuescript https://yuescript.org

on Pluto, a Modern Lua Dialect

0

Dec 28, 2023

Yes, this is unfortunately true. There's a spiritual, mostly compatible, successor that is under active development: https://yuescript.org/

on Lua, a Misunderstood Language (2021)

0

Sep 29, 2022

Yuescript is a dynamic language that compiles to Lua

33

Jan 12, 2022

README

YueScript

YueScript logo
A delightful language that compiles to Lua
Dynamic, expressive, and concise syntax for Lua development.
Docs · Try Online · Discord

Xiaoyu, the YueScript mascot

Xiaoyu (小玉) · Official YueScript Mascot

IppClub Ubuntu Windows macOS Discord Badge

YueScript is a language that compiles to Lua. It is derived from MoonScript 0.5.0 and continues to adopt new features to stay up to date.

Overview

MoonScript has been used to build real-world projects such as Lapis, itch.io, and streak.club. MoonScript itself was also influenced by languages such as CoffeeScript. As the original implementation became harder to evolve without risking compatibility, YueScript was created as a modernized code base for pushing the language forward.

YueScript is both a production-ready compiler and a playground for exploring new syntax and programming paradigms that make Lua development more expressive and productive.

Yue (月) is the Chinese word for moon and is pronounced [jyɛ].

About Dora SSR

YueScript is being developed and maintained alongside the open-source game engine Dora SSR. It has been used to create engine tools, game demos and prototypes, validating its capabilities in real-world scenarios while enhancing the Dora SSR development experience.

Features

  • Based on a modified parserlib with performance enhancements. lpeg is no longer required.
  • Written in C++17.
  • Supports most MoonScript features and generates Lua code in a style compatible with the original compiler.
  • Preserves source line numbers in generated Lua to improve debugging.
  • Adds features like macros, existential operator, pipe operator, JavaScript-like export syntax, and more.
  • See CHANGELOG.md for more details.

Installation

Lua Module

Build yue.so with:

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

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

Or install via LuaRocks:

> 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 (CLI)

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] [<file/directory>] ...
       yue -e <code_or_file> [args...]
       yue -w [<directory>] [options]
       yue -

Notes:
   - '-' / '--' must be the first and only argument.
   - '-o/--output' can not be used with multiple input files.
   - '-w/--watch' can not be used with file input (directory only).
   - with '-e/--execute', remaining tokens are treated as script args.

Options:
   -h, --help                 Show this help message and exit.
   -e <str>, --execute <str>  Execute a file or raw codes
   -m, --minify               Generate minified codes
   -r, --rewrite              Rewrite output to match original line numbers
   -t <output_to>, --output-to <output_to>
                              Specify where to place compiled files
   -o <file>, --output <file> Write output to file
   -p, --print                Write output to standard out
   -b, --benchmark            Dump compile time (doesn't write output)
   -g, --globals              Dump global variables used in NAME LINE COLUMN
   -s, --spaces               Use spaces in generated codes instead of tabs
   -l, --line-numbers         Write line numbers from source codes
   -j, --no-implicit-return   Disable implicit return at end of file
   -c, --reserve-comments     Reserve comments before statement from source codes
   -w [<dir>], --watch [<dir>]
                              Watch changes and compile every file under directory
   -v, --version              Print version
   -                          Read from standard in, print to standard out
                              (Must be first and only argument)
   --                         Same as '-' (kept for backward compatibility)

   --target <version>         Specify the Lua version that codes will be generated to
                              (version can only be 5.1 to 5.5)
   --path <path_str>          Append an extra Lua search path string to package.path
   --<key>=<value>            Pass compiler option in key=value form (existing behavior)

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

Common Usage

  • 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

Mascot (Xiaoyu / 小玉)

Xiaoyu (小玉) is YueScript's official mascot, a cyber rabbit often seen perched on a crescent moon and coding on a laptop.

Editor Support

License

MIT

cpp
lua
moonscript
transpiler
yuescript

Significant stargazers

ven

297 followers · starred May 2021

Steve Vermeulen

370 followers · starred Aug 2021

Martin Angers

625 followers · starred Mar 2022

Ian Chamberlain

24 followers · starred Mar 2025