Awesome
BlazeX
An object orineted AOT compiled language which is gradual typed
Installing
$ git clone https://github.com/BlazifyOrg/blazex.git
$ cd blazex
$ make
$ cd ..
# Set $HOME/.blazex to PATH
Confirm Installation
$ blazex
error: The following required arguments were not provided:
<path>
USAGE:
blazex [FLAGS] [OPTIONS] <path>
For more information try --help
Example
- Printing the famous "Hello World"
extern variadic fun printf(string): int;
printf("Hello World!") @ yep as simple as that
- Comments
@ single line comment
@@
multi-line comment
@@
- Creating and calling functions
fun sum(a, b) {
var c = a + b;
return c;
}
println("%i", sum(2, 2));
- Working around with objects
var obj = {
prop: 5 @ properties should be Identifier or there will be Invalid Syntax Error
}
println("%i", obj.prop); @ accessing object property
obj.prop = 10; @ editing object property value
println("%i", obj.prop) @ 10
- Classes
class Main {
var a = 10; @ this is a property
@ this is constructor
fun() {
soul.a = 5; @ soul is the current object it's operating on
}
@ this is a method
fun sum_to_a(b) {
soul.a = soul.a + b;
return soul.a;
}
}
var ins = new Main(); @ creating/initializing a class, returns a object with the properties
println("%i", ins.sum_to_a(5));
Dependencies
- llvm_sys (Interacting with LLVM)
- codespan-reporting (Errors)
- mimalloc (Memory allocation)
- structopt (Argument parsing)
- notify (Look for file changes)
Contributing
- Fork the repository
- Create a branch with the patch/feature you want
- Make Changes to the code
- Commit the code (Use the Emoji Commit Style) and the message should ** NOT** contain the word "release"
- Finally, push the code and make a pull request
Project Structure
Crate | Description |
---|---|
blazex | The binary |
bzxc_lexer | Lexer for Tokenizing |
bzxc_parser | Parser for AST Tree |
bzxc_type_system | Type System |
bzxc_llvm | LLVM IR Code Generation |
bzxc_shared | Things Shared among crates |
TODO
- Type System
- LLVM
- Errors
- Lexer
- Parser
- Type System
- LLVM
- Reading from file
- Lexer
- Parser
- AST