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.
Common errors
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'.
Warnings
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.
Install
npm install samalang-compiler yarn add samalang-compiler pnpm add samalang-compiler Imports
- compile wrong
const { compile } = require('samalang-compiler')correctimport { compile } from 'samalang-compiler' - compileFile wrong
import compileFile from 'samalang-compiler/compileFile'correctimport { compileFile } from 'samalang-compiler' - default wrong
const Samalang = require('samalang-compiler').defaultcorrectimport Samalang from 'samalang-compiler'
Quickstart
import { compile } from 'samalang-compiler';
const luaCode = compile('print "Hello, Samala!"');
console.log(luaCode);