Lesma Programming Language
Branch: master
Clone or download
Latest commit b1db48b Jan 30, 2019

README.md

Lesma Programming Language


License: GPL v3 Version CircleCI Codacy Badge

Lesma is a compiled, statically typed, imperative and object-oriented programming language with a focus on expressiveness, elegancy, and simplicity, while not sacrificing on performance. The compiler is written in Python (for now, C++ coming) using LLVM as a backend.

Currently an early Work in Progress, and many thanks to Ayehavgunne and his Mythril project for helping me by showcasing advanced examples of llvmlite and providing a base code.

Features

  • it's fast, because it should be so, together with LLVM's state of the art optimizations, but it won't ever oblige you to make an extra effort from your side just for the sake of performance
  • it's compiled both AOT and JIT, so you can finally decide if you just want to run it or compile it and distribute your project without dependencies, and because binary size also matters, a Hello World example would be around 8kb
  • it's statically typed so you don't need to guess the type of the variable if your coworker didn't spend the time to use meaningful names and you can make use of compile-time checks, autocomplete and more
  • it's simple and expressive because the code should be easily readable and it shouldn't make you guess what it does

Influences

  • Python
  • Swift
  • Typescript
  • Lua

Installing

You can pick up the latest release in Releases and start using it. Lesma is currently being tested and provides binaries only for Unix. Compatibility between operating systems and architectures is not hard to achieve, but simply not a priority at the moment.

Windows is also supported but you need to do additional work if you want to compile Lesma code (need to install clang, but this is not properly tested at the moment) and there are issues with Unicode characters, but all the tests pass and everything else seems to work.

In the case that your platform is not oficially supported, you need to build it on your own.

Documentation

Build

In order to build Lesma, you need to have at least Python 3.5 installed. It's currently tested only on Linux. It makes use of clang to compile the resulting object file currently, so you need it installed, but only running a file doesn't require clang.

Clone the repo:

git clone https://github.com/hassanalinali/Lesma

Install the requirements

sudo apt install clang -y
pip install -r requirements.txt

Done! Now you can run the compiler or the interpreter, make a test file and hack your way around. Remember there are examples in the documentation.

python src/les.py run test.les
python src/les.py compile test.les

Or install pytest and run the unit tests yourself

pytest

For advanced usage or help, consult the CLI help menu

python src/les.py -h