1
1
Fork 0
mirror of https://github.com/azur1s/bobbylisp.git synced 2024-10-16 02:37:40 -05:00
bobbylisp/README.md

75 lines
2.2 KiB
Markdown
Raw Normal View History

2022-03-11 20:52:24 -06:00
# Hazure
2022-03-07 02:16:41 -06:00
Programming language that compiles to C++!
2022-02-25 02:59:17 -06:00
2022-03-12 17:47:31 -06:00
```sml
2022-03-11 19:39:37 -06:00
fun main: int = do
@write("Hello, World!\n");
return 69;
2022-03-11 19:39:37 -06:00
end;
```
2022-03-12 17:46:50 -06:00
or with the pipe operator:
2022-03-12 17:47:31 -06:00
```sml
2022-03-12 17:46:50 -06:00
fun main: int = do
"Hello, World!\n"
2022-03-12 23:49:00 -06:00
|> @write(_);
2022-03-12 17:46:50 -06:00
return 69;
end;
```
2022-03-12 19:45:58 -06:00
> The `return 69` is the exit code (like C++), try running `echo $?` to see it!
2022-03-06 14:53:44 -06:00
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)
2022-02-12 08:28:56 -06:00
2022-03-13 00:05:50 -06:00
# How it works
2022-03-13 00:14:13 -06:00
```
2022-03-13 00:05:50 -06:00
Source (.hz)
2022-03-13 00:12:44 -06:00
│ crates/main
2022-03-13 00:05:50 -06:00
Lexer produce Token
2022-03-13 00:12:44 -06:00
│ crates/lexer
2022-03-13 00:05:50 -06:00
Parser produce AST
2022-03-13 00:12:44 -06:00
│ crates/parser
2022-03-13 00:05:50 -06:00
Diagnostic(Parsing)
2022-03-13 00:12:44 -06:00
│ │ crates/diagnostic
│ ╰ Fail -> Print error -> Exit
Pass
2022-03-13 00:05:50 -06:00
Lowerer(?) produce HIR
2022-03-13 00:12:44 -06:00
│ crates/hir
2022-03-13 01:22:53 -06:00
Type Checker (TODO)
│ │
│ ╰ Fail -> Print error -> Exit
Pass
2022-03-13 00:05:50 -06:00
Diagnostic(Lowering)
2022-03-13 00:12:44 -06:00
│ │ crates/diagnostic
│ ╰ Fail -> Print error -> Exit
Pass
2022-03-13 00:05:50 -06:00
Command Codegen produce C++
2022-03-13 00:12:44 -06:00
(spawn) │ crates/codegen
│ │
│ │
clang++ ─────┴───── Executable
2022-03-13 00:05:50 -06:00
(Command)
```
# Prerequistie
2022-03-11 18:14:01 -06:00
- `clang++`(preferred, default) or any C++ compiler
2022-03-12 17:26:59 -06:00
- `make` for Makefile
- Rust (if you're going to build from source)
2022-03-11 18:14:31 -06:00
# Configuration
2022-03-11 18:14:01 -06:00
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++"
```
2022-02-25 04:03:55 -06:00
# License
2022-03-12 17:26:59 -06:00
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)