-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
1,798 additions
and
21 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
[workspace] | ||
members = [ | ||
"bindlang", | ||
"lang_bindings", | ||
"gen", | ||
"core", | ||
"synth", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "bindlang" | ||
version = "0.1.0" | ||
edition = "2018" | ||
|
||
[lib] | ||
proc-macro = true | ||
|
||
[dependencies] | ||
syn = { version = "1.0", features = ["extra-traits", "full", "fold", "parsing", "proc-macro"] } | ||
quote = "1.0" | ||
koto = { git = "https://github.com/llogiq/koto", branch = "vtable" } | ||
koto_runtime = { git = "https://github.com/llogiq/koto", branch = "vtable" } | ||
lang_bindings = { path = "../lang_bindings" } | ||
lazy_static = "1.4.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use bindlang::{bindlang, bindlang_main}; | ||
use std::fmt::{Display, Formatter, Result as FmtResult}; | ||
|
||
#[bindlang] | ||
pub fn bound(_b: bool, _i: i64, _f: f32, _u: u8) { | ||
// nothing to see here | ||
} | ||
|
||
#[bindlang] | ||
pub fn anotherone() { | ||
// still nothing | ||
} | ||
|
||
#[bindlang] | ||
#[derive(Clone, Debug, Default)] | ||
pub struct MyType; | ||
|
||
//#[bindlang] | ||
impl Display for MyType { | ||
fn fmt(&self, f: &mut Formatter) -> FmtResult { | ||
write!(f, "{:?}", self) | ||
} | ||
} | ||
|
||
#[bindlang] | ||
impl MyType { | ||
pub fn new() -> Self { MyType } | ||
|
||
pub fn answer(&self) -> usize { | ||
42 | ||
} | ||
} | ||
|
||
bindlang_main!(); | ||
|
||
fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
let mut koto = koto::Koto::default(); | ||
bindlang_init(&mut koto.prelude()); | ||
koto.compile("import MyType\nMyType.new().answer()")?; | ||
println!("{}", koto.run()?); | ||
Ok(()) | ||
} |
Oops, something went wrong.