mirror of
https://github.com/azur1s/bobbylisp.git
synced 2024-10-16 02:37:40 -05:00
69 lines
2 KiB
Markdown
69 lines
2 KiB
Markdown
# Hazure
|
|
Programming language that compiles to C++!
|
|
|
|
```sml
|
|
fun main: int = do
|
|
@write("Hello, World!\n");
|
|
return 69;
|
|
end;
|
|
```
|
|
or with the pipe operator:
|
|
```sml
|
|
fun main: int = do
|
|
"Hello, World!\n"
|
|
|> @write(_);
|
|
return 69;
|
|
end;
|
|
```
|
|
> The `return 69` is the exit code (like C++), try running `echo $?` to see it!
|
|
|
|
Note: Everything in this project can be changed at anytime! (I'm still finding out what work best for lots of thing) if you have an idea, feel free to create an issues about it, or even create a PR! (I'd be very happy)
|
|
|
|
# How it works
|
|
```sml
|
|
Source (.hz)
|
|
| crates/main
|
|
v
|
|
Lexer produce Token
|
|
| crates/lexer
|
|
v
|
|
Parser produce AST
|
|
| crates/parser
|
|
v
|
|
Diagnostic(Parsing)
|
|
| \ crates/diagnostic
|
|
| \
|
|
Pass Fail -> Print error -> Exit
|
|
|
|
|
v
|
|
Lowerer(?) produce HIR
|
|
| crates/hir
|
|
v
|
|
Diagnostic(Lowering)
|
|
| \ crates/diagnostic
|
|
v \
|
|
Pass Fail -> Print error -> Exit
|
|
|
|
|
v
|
|
Command Codegen produce C++
|
|
(spawn) | crates/codegen
|
|
| |
|
|
v v
|
|
clang++ -----*-----> Executable
|
|
(Command)
|
|
```
|
|
|
|
# Prerequistie
|
|
- `clang++`(preferred, default) or any C++ compiler
|
|
- `make` for Makefile
|
|
- Rust (if you're going to build from source)
|
|
|
|
# Configuration
|
|
You can also configurate Hades compiler (currently you can only change the C++ compiler). Make a new file called `hades.toml` in the current working directory and the compiler will look for it! if there isn't one then it will use the default configuration:
|
|
```toml
|
|
[compiler]
|
|
compiler = "clang++"
|
|
```
|
|
|
|
# License
|
|
Hades is licensed under both [MIT license](https://github.com/azur1s/hades/blob/master/LICENSE-MIT) and [Apache License](https://github.com/azur1s/hades/blob/master/LICENSE-APACHE) |