summaryrefslogtreecommitdiff
path: root/matrix-lang/src/lib.rs
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-02-29 17:04:28 -0500
committerFreya Murphy <freya@freyacat.org>2024-02-29 17:04:28 -0500
commit5d2747e26f51cc2344a6bd95f93457248fdfebd8 (patch)
tree8755b4068166c3854d26817683ce438a771ab319 /matrix-lang/src/lib.rs
parentmore mat, sys, and os stdlib functions, better matrix printing, other fixes (diff)
downloadmatrix-5d2747e26f51cc2344a6bd95f93457248fdfebd8.tar.gz
matrix-5d2747e26f51cc2344a6bd95f93457248fdfebd8.tar.bz2
matrix-5d2747e26f51cc2344a6bd95f93457248fdfebd8.zip
fin prob
Diffstat (limited to '')
-rw-r--r--matrix-lang/src/lib.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/matrix-lang/src/lib.rs b/matrix-lang/src/lib.rs
new file mode 100644
index 0000000..1452a09
--- /dev/null
+++ b/matrix-lang/src/lib.rs
@@ -0,0 +1,42 @@
+mod compiler;
+mod value;
+mod lex;
+mod vm;
+mod parse;
+mod chunk;
+mod ast;
+mod binary;
+
+pub mod prelude;
+
+#[macro_export]
+macro_rules! iter {
+ ($fn:expr) => {
+ $crate::prelude::Value::Iter(
+ ::std::rc::Rc::new(
+ $crate::prelude::Function {
+ name: ::std::rc::Rc::from("<iterator>"),
+ arity: 0,
+ variadic: false,
+ fun: $crate::prelude::InnerFunction::Native(
+ ::std::rc::Rc::new($fn
+ ))}))
+ };
+}
+
+#[macro_export]
+macro_rules! native {
+ ($name:expr, $arity:expr, $varadic:expr, $fn:expr) => {
+ $crate::prelude::Value::Function(
+ ::std::rc::Rc::new( $crate::prelude::Function {
+ name: std::rc::Rc::from($name),
+ arity: $arity,
+ variadic: $varadic,
+ fun: $crate::prelude::InnerFunction::Native(
+ ::std::rc::Rc::new($fn)
+ )
+ })
+ )
+ }
+}
+