Skip to content

ifritJP/LuneScript

Repository files navigation

LuneScript

https://github.com/ifritJP/LuneScript/workflows/Test/badge.svg

Latest document.

What is LuneScript

As mentioned above, LuneScript is a language that covers Lua’s concerns, and is a transcompiler that can convert code developed with LuneScript into Lua code.

LuneScript has the following features.

  • NULL safety.
  • Since it is a statically typed language, simple mistakes can be found at compile time by type checking.
  • Type inference minimizes the effort of type declaration.
  • With generics, it is possible to process while preserving type information.
  • Supports class definition as language grammar.
  • Supports pattern matching. (match)
  • Reduced load time due to lazy loading.
  • Mutual conversion between structured and unstructured data. (Mapping)
  • With macros, it is possible to realize designs that do not rely on dynamic processing such as polymorphism.
  • Detects variable initialization omission
  • Transcompile to Lua and go.
  • Supports JSON compatible data representation.
  • The transcompiled Lua code can operate independently without assuming an external library.
  • The transcompiled Lua code outputs the processing written in LuneScript as it is, so there is no performance degradation.
  • Existing Lua external modules available from LuneScript.
  • LuneScript runs on Lua and requires only Lua standard modules, so it’s easy to deploy.
    • With the go version of LuneScript, transcompile time can be reduced to 1/20.
  • Lua modules converted from LuneScript can be used from other Lua modules.
  • Supports Lua5.1 ~ 5.4.
  • LuneScript is self-hosted.
  • Supports code completion in emacs
  • Supports tag jump by lnstags
  • Supports automatic generation of glue code
  • The learning cost is low because it is based on the syntax of Lua and C.

Setup LuneScript

We have prepared a Dockerfile for building LuneScript from the source registered in git.

https://github.com/ifritJP/LuneScript/tree/master/src/test/docker/compose

  • linux/build/Dockerfile
  • alpine/build/Dockerfile

The following will generate lnsc for Linux in LuneScript / src:

$ git clone --depth 1 https://github.com/ifritJP/LuneScript
$ cd LuneScript/src
$ sudo docker build -t linux_lns test/docker/compose/linux/build
$ sudo docker run --rm -v $PWD:/local linux_lns cp /usr/bin/lnsc /local/lnsc

Put lnsc in your PATH.

In the proxy environment, specify proxy as shown below when docker build.

$ sudo docker build -t linux_lns test/docker/compose/linux/build --build-arg PROXY=http://proxy.hoge/

This concludes the introduction of the go version of LuneScript.