NP: i haven't really have put any effort in updating this readme, but this was forked from egordorichev/lit
a quick overview what I've changed:
- relaxed parser - brackets no longer need to be on the same line
- optional switch/case in the virtual machine (could be unstable!)
- mild attempt to support windows
- generous code cleanup
lit
Lit is a dynamicaly-typed language, inspired by highly-hackable Lua and familiar C-styled JavaScipt. You can try it out in your browser!
Lua | JavaScript | Lit | ||
---|---|---|---|---|
Easy classes | Example | |||
Arrays start from | 1 (WHAT) | 0 | 0 | Balance in the universe is restored |
String interpolation | Example | |||
Operator overloading | Example | |||
Easy to embed | Example | |||
Has no undefined |
Seriously, why, JS?? | |||
Syntax sugar like += |
Example | |||
Coroutines (fibers) | Example |
Sounds good? Check out some challenge solutions or try lit for yourself!
Building
Lit has no external dependencies (besides Emscripten, but that's only for the HTML5 builds), so you will only need gcc, make & cmake.
On linux, you will also need to install libreadline:
sudo apt-get install libreadline6-dev
git clone https://github.com/egordorichev/lit/ && cd lit
cmake .
make
sudo make install
That should install lit, and you should be able to access it from the console. Let's write our first program:
print("Hello, world!")
Just run it, and you should see the familiar message in your terminal:
lit hello.lit
That's it! Now you are ready to face a more serious challenge, like the examples or challenges! Or alternatively, lit runs just fine in browsers.
Syntax Highlighting
If you want syntax highlighting in Visual Studio Code, see lit-vscode.
History
This is not the first version of lit. And not second. Sadly, most of the versions got lost along the way, but you still can checkout previous version of lit, that was staticly-typed!