egordorichev / static-lit

Ancient branch of lit, before it became dynamicly-typed.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lit

This is an old version of lit, preserved for history. See out this repo for the current version!

lit is a tiny and fast language, designed to be embeddable and used as a scripting language. It takes inspiration from JavaScript, Java, C# and Lua, and combines them all into a statically-typed stack-vm based language.

Here is how it looks:

int do_thing(String a) {
  print(a)
  return 3
}

var x = 10
var a = do_thing("10") // -> 10, a is 3

class Awesome {
  var test = "Awesome" // Protected by default  
    
  void doStuff() { // Public by default
    print(this.test)
  }
}

var a = Awesome()
a.doStuff() // -> Awesome

if true { 
  // You can ignore () if you want, but you sill can
  // do this: if (true) { ... }
  // or this: if !(true && false) { .. }
  print("Truth is right!") 
}

Please note, that the language is still in it's early stages, and I would recommend not using it right now. Tho it's growing pretty fast ;)

Building

To build lit, you will only need cmake, make and GCC (4.9.0+):

cd lit
cmake .
make

To run a program simply use:

./lit test/main.lit

Thanks

Big thanks to Bob Nystrom for his amazing book about interpreters. Make sure to check it out!

About

Ancient branch of lit, before it became dynamicly-typed.

License:MIT License


Languages

Language:C 92.5%Language:Python 4.3%Language:Objective-C 2.6%Language:C++ 0.4%Language:CMake 0.3%