1
1
Fork 0
mirror of https://github.com/azur1s/bobbylisp.git synced 2024-10-16 02:37:40 -05:00
Another lisp dialect (mirror)
Find a file
2022-03-13 16:21:33 +07:00
crates some more docs for contributors 2022-03-13 16:21:33 +07:00
example some more docs for contributors 2022-03-13 16:21:33 +07:00
lib misc fix 2022-03-13 14:22:53 +07:00
.gitignore generate comment 2022-03-12 10:38:18 +07:00
Cargo.lock lowering error report 2022-03-12 20:46:43 +07:00
Cargo.toml diagnostic crate 2022-03-12 06:35:14 +07:00
FUNDING.yml update misc stuff 2022-03-07 03:53:44 +07:00
hazure.toml hades is already taken 2022-03-12 09:52:24 +07:00
LICENSE-APACHE rename (again) 2022-03-06 23:51:03 +07:00
LICENSE-MIT rename (again) 2022-03-06 23:51:03 +07:00
Makefile misc fix 2022-03-13 14:22:53 +07:00
README.md some more docs for contributors 2022-03-13 16:21:33 +07:00

Hazure

Programming language that compiles to C++!

fun main: int = do
    @write("Hello, World!\n");
    return 69;
end;

or with the pipe operator:

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)

Contributing

Found a bug? Found a better way to do something? Make a pull request or tell me in the issues tab! Anything contributions helps :D

Wanna see how it works under the hood? see the How it works tab, you should probably understand it a bit more.

Steps to build:

  1. Clone this repo https://github.com/azur1s/hazure.git
  2. Run sudo make build-lib to build the library (for the transpiled output)
  3. Build executable cargo build
  4. Try running some examples! path/to/executable compile path/to/file.hz

How it works

           Source (.hz)
              │ crates/main
              │
            Lexer produce Token
              │ crates/lexer
              │
           Parser produce AST
              │ crates/parser
              │
         Diagnostic(Parsing)
              │     │ crates/diagnostic
              │     ╰ Fail -> Print error -> Exit
             Pass
              │
              │
          Lowerer(?) produce HIR
              │ crates/hir
              │
          Type Checker (TODO)
              │   │
              │   ╰ Fail -> Print error -> Exit
             Pass
              │
              │
         Diagnostic(Lowering)
              │     │ crates/diagnostic
              │     ╰ Fail -> Print error -> Exit
             Pass
              │
              │
 Command   Codegen produce C++
 (spawn)      │ crates/codegen
    │         │
    │         │
 clang++ ─────┴───── Executable
(Command)

Prerequistie

  • clang++(preferred, default) or any C++ compiler
  • make for Makefile
  • Rust (if you're going to build from source)

Problems

This is the problem(s) of the language I found throughout while developing it

  • Diagnostics stuff only report one error, maybe because of the early return when errors make it only return after first error. Fix is maybe make an error type and continue doing it stuff even if found the error. (Fixable)

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:

[compiler]
compiler = "clang++"

License

Hades is licensed under both MIT license and Apache License