Samala Compiler

raw JSON →
1.3.0 verified Fri May 01 auth: no javascript

The Samala Compiler compiles the Samawa programming language into Lua. Version 1.3.0 is the latest stable release. It transpiles Samawa code to Lua, enabling execution in Lua environments. Active development is uncertain due to limited community engagement and documentation. Key differentiators include targeting the niche Samawa language, which is designed for simplicity and embedding in Lua projects.

error SyntaxError: Unexpected token ';' at line 1
cause Using semicolons in Samawa code, which are not supported.
fix
Remove semicolons; they are optional and cause parse errors.
error TypeError: compile is not a function
cause Importing incorrectly as default instead of named export.
fix
Use import { compile } from 'samalang-compiler'.
deprecated compileFile() is deprecated; use compile with file contents instead.
fix Read file manually and pass contents to compile().
breaking Version 1.0.0 changed output syntax from Lua 5.1 to 5.3.
fix Ensure your Lua runtime supports Lua 5.3 features.
gotcha Strings in Samawa must be double-quoted; single quotes cause parse errors.
fix Always use double quotes for string literals.
npm install samalang-compiler
yarn add samalang-compiler
pnpm add samalang-compiler

Compiles a simple Samawa print statement to Lua and logs the result.

import { compile } from 'samalang-compiler';
const luaCode = compile('print "Hello, Samala!"');
console.log(luaCode);