A simple dynamically typed (with type annotations), lightweight programming language designed to be simple and clear. Your feedback and contributions are welcome!
- Clone the repo
git clone https://github.com/re-masashi/lyron.git cd lyron
- Build Lyron
or, if you want to have GxHash (a faster hashmap implementation) enabled.
cargo build --release
RUSTFLAGS="-C target-cpu=native" cargo build --release --features gxhash
Create hello.ly
:
# hello.ly
print("Hello, Lyron!")
Run it:
lyron hello.ly
# → Hello, Lyron!
-
Functions:
- Defining a function
def sum(a:i32, b:i32) -> i32 a+b end
- Calling a function
sum(a, b)
- Defining a function
-
Class
- A class in lyron is just a collection of functions and attributes
- Constructors should have the same name as the class. Eg:
class Animal{ def Animal(self: Self, age: i32)->Animal do print("i'm an animal ") print("i'm "+age+" years old.") self = setattr(self, "age", age) # `self.age = age` is invalid! self end def sound(self: Self) -> Animal print("i make a sound") }
-
Variables:
- Declaration:
let x: i32
- Assignment:
x = 42
Note: Both need to be done separately.
- Declaration:
-
Operations
- Available operations
=
,+
,-
,*
,/
,==
,!=
,<
,>
,<=
,>=
,+=
,-=
,*=
,/=
let a: i32 = (-b + 5) - 10 / -(5 - -2)
- Available operations
-
Comments
- Comments start with
#
and continue until the end of the line# this is a comment
- Comments start with
-
Programs
- A program consists of just top-level functions, classes, and expressions.
- Fork the repo
- Create a branch:
git checkout -b feature/YourFeature
- Make your changes & add tests
- Submit a PR against
main
- Core parser improvements (better errors, etc)
- ?Standard library: collections, I/O
- Module system
- Package Manager
- Performance Improvements (make it 4x faster than now, 9th April 2025)
Note: ? indicates half-done stuff
MIT © Masashi