Lovely is a low-level systems programming language, designed to be used to create the Humble operating system.
All language features are being developed on live stream on my YouTube channel; however, if you you have any optimizations/enhancements/fixes you want to contribute, please feel free to open a PR! I'm not currently accepting PRs that add new features/functionality to the language, because this is a learning project and I'd like to give those things a shot myself.
Mutable variables are declared using :=, and immutable ones with :::
foo := 4; # mutable var
bar :: 2; # immutable var
Types are infered, but can be specified like so:
foo : Int = 4;
bar : Int : 2;
If you specify the type, you can declare and initialize a variable on two differnt lines:
# declare foo
foo : Int;
# later...
foo = 4;
Comments begin with # and continue to the end of the line.
Lovely supports the following primitive data types:
Int: a signed int of size TODOUnit: equivalent tovoidor()in some other languagesBool:trueorfalse
Lovely supports the following operators:
Arithmentic:
+: addition-: minus if infix, negative if prefix*: multiplication/: division
Comparative:
==: equality!=: inequality<: less than>: greater than<=: less than or equal>=: greater than or equal
Logical operators:
!: negates a boolean
Bitwise operators:
&: bitwise and|: bitwise or^: bitwise xor~: bitwise negation
Parentheses can be used to group expressions:
3 * (4 + 5)
Function expressions use the following format:
fun (<parameters>) <return_type> { <body> }
Function parameters can optionally have two labels, one for use inside the function implementation, and one for the callsite; if you only use one label, it will be used in both places. If you don't want to have to provide a label at the callsite, prefix the label with ~.
add :: fun (~first: Int, to second: Int) Int {
first + second
};
add(3, to: 4);