mirror of
https://github.com/azur1s/bobbylisp.git
synced 2024-10-16 02:37:40 -05:00
Compare commits
No commits in common. "24dbfc23ffe462bc009c47a5776155e297cf3597" and "a8e6dad43311746c3ad17701cd7c077ed678780d" have entirely different histories.
24dbfc23ff
...
a8e6dad433
11
README.md
11
README.md
|
@ -19,17 +19,6 @@ 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)
|
||||||
|
|
|
@ -116,13 +116,12 @@ 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 }))
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get the index where the `Hole` is at
|
// Remove all `Hole`(s) from the args
|
||||||
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(),
|
||||||
|
@ -131,7 +130,6 @@ 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());
|
||||||
|
|
||||||
|
@ -154,7 +152,6 @@ 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,4 +2,8 @@ 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