mirror of
https://github.com/azur1s/bobbylisp.git
synced 2024-10-16 02:37:40 -05:00
some more docs for contributors
This commit is contained in:
parent
a8e6dad433
commit
40a7d1d3c3
15
README.md
15
README.md
|
@ -19,6 +19,17 @@ end;
|
||||||
|
|
||||||
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)
|
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](https://github.com/azur1s/hazure#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
|
# How it works
|
||||||
```
|
```
|
||||||
Source (.hz)
|
Source (.hz)
|
||||||
|
@ -64,6 +75,10 @@ Note: Everything in this project can be changed at anytime! (I'm still finding o
|
||||||
- `make` for Makefile
|
- `make` for Makefile
|
||||||
- Rust (if you're going to build from source)
|
- 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
|
# 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:
|
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
|
```toml
|
||||||
|
|
|
@ -116,12 +116,13 @@ pub fn expr_to_ir(expr: &Expr) -> (Option<IRKind>, Option<LoweringError>) {
|
||||||
_ => return (None, Some(LoweringError { span: name.1.clone(), message: "Expected identifier".to_string(), note: None }))
|
_ => return (None, Some(LoweringError { span: name.1.clone(), message: "Expected identifier".to_string(), note: None }))
|
||||||
};
|
};
|
||||||
|
|
||||||
// Remove all `Hole`(s) from the args
|
// Get the index where the `Hole` is at
|
||||||
let index = args.0.iter().position(|arg| match arg.0 {
|
let index = args.0.iter().position(|arg| match arg.0 {
|
||||||
Expr::Hole(..) => true,
|
Expr::Hole(..) => true,
|
||||||
_ => false
|
_ => false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// If there is no `Hole` in the args then return early
|
||||||
if let None = index {
|
if let None = index {
|
||||||
return (None, Some(LoweringError {
|
return (None, Some(LoweringError {
|
||||||
span: rhs.1.clone(),
|
span: rhs.1.clone(),
|
||||||
|
@ -130,6 +131,7 @@ pub fn expr_to_ir(expr: &Expr) -> (Option<IRKind>, Option<LoweringError>) {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove the `Hole` from the args
|
||||||
let mut new_args = args.0.clone();
|
let mut new_args = args.0.clone();
|
||||||
new_args.remove(index.unwrap());
|
new_args.remove(index.unwrap());
|
||||||
|
|
||||||
|
@ -152,6 +154,7 @@ pub fn expr_to_ir(expr: &Expr) -> (Option<IRKind>, Option<LoweringError>) {
|
||||||
let mut largs = Vec::new();
|
let mut largs = Vec::new();
|
||||||
for arg in &args.0 {
|
for arg in &args.0 {
|
||||||
match arg.0 {
|
match arg.0 {
|
||||||
|
// If the arg is a `Hole` then replace it with the lowered IR
|
||||||
Expr::Hole(..) => {
|
Expr::Hole(..) => {
|
||||||
largs.push(lhs_ir.0.clone().unwrap());
|
largs.push(lhs_ir.0.clone().unwrap());
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,8 +2,4 @@ fun main: int = do
|
||||||
-- Normal way of hello world
|
-- Normal way of hello world
|
||||||
@write("Hello, World!\n");
|
@write("Hello, World!\n");
|
||||||
return 69;
|
return 69;
|
||||||
|
|
||||||
-- Hello world piped to @write() function
|
|
||||||
"Hello, World!\n"
|
|
||||||
|> @write();
|
|
||||||
end;
|
end;
|
Loading…
Reference in a new issue