I built a Minecraft scripting language that compiles to Java instead of running an interpreter

U

/u/Commercial-Day2375

Guest
Hey! I have been working on a scripting language called Lumen.

The idea is pretty simple: instead of interpreting scripts at runtime, Lumen compiles scripts directly into normal Java code, and runs them.

It’s not meant to be one of those misleading scripting languages like “Skript but 10x faster and less memory usage”.

Skript is very easy to use, while writing a full Java plugin gives you full flexibility, but comes with a lot of boilerplate and harder back and forth iteration. For example, using things like Paper’s command API requires restarting or fully reloading the server, and support for config hot reloads and similar features must be added manually.

Lumen sits in between.

It offers:

  • a structured scripting language with a real compilation pipeline
  • a simple to use addon api for developers, which is also used by the main plugin, allowing you the same flexibility
  • full hot reload support (save file -> instant update, no restart, no commands)
  • scripts that behave much closer to plugin code
  • VSCode extension (LSP), which uses the same backend as the plugin. Offers things like tab completion, hover information, errors in the editor, data classes, and much more.

Performance-wise, Lumen scripts are compiled into real Java classes, which allows the JVM to optimize them just like normal plugin code. For smaller scripts, the generated code will be identical to handwritten Java. For larger systems, the JVM’s optimizations still apply, so performance remains very close.

Interpreted languages like Skript cannot benefit from these optimizations in the same way at all.

Github: https://github.com/LumenLang/lumen

Reference Documentation: https://lumenlang.dev/

Spigot: https://www.spigotmc.org/resources/133091/

submitted by /u/Commercial-Day2375
[link] [comments]

Continue reading...
 
Back
Top