Sol - A C-like language inspired by JavaScript that compiles to Lua
Disclaimer: The current version of Sol is more a proof of concept than an complete language. Future versions will bring more features and better documentation
Comments:
Single line comments start with '//' and continue until the end of the line
Multi line comments start with '/*' and end with '*/'
Literals
- Numbers are written with or without decimals: 100, 1.6, 0.9
- Strings are text, written within double or single quotes: 'Hello, World!', "Hello, World!"
Functions
Functions are declared using the 'fn' keyword
fn sum(a, b) {
return a+b
}
GitHub (https://github.com/NihilisticPuffin/Sol)
Install:
wget run https://raw.githubusercontent.com/NihilisticPuffin/Sol/main/installer.lua
Usage:
sol.lua input.sol [-o output] [--log]
Example Sol Code
// C Style Comments
/*
And Block Comments too
*/
local name = 'Allen'
age = 21
fn makeGreeting() {
// Supports String Interpolation
return "Hello, my name is ${name} and I am ${age} years old!"
}
greeting = makeGreeting()
print(greeting)
Lua Output
local name = 'Allen'
age = 21
function makeGreeting()
return string.format("Hello, my name is %s and I am %s years old!", name, age)
end
greeting = makeGreeting()
print(greeting)