diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..05e9b1c --- /dev/null +++ b/src/lib.rs @@ -0,0 +1 @@ +mod push; diff --git a/src/push/instructions/instruction.rs b/src/push/instructions/instruction.rs new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/src/push/instructions/instruction.rs @@ -0,0 +1 @@ + diff --git a/src/push/instructions/mod.rs b/src/push/instructions/mod.rs new file mode 100644 index 0000000..04407a0 --- /dev/null +++ b/src/push/instructions/mod.rs @@ -0,0 +1,2 @@ +mod instruction; +mod numeric; diff --git a/src/push/instructions/numeric.rs b/src/push/instructions/numeric.rs new file mode 100644 index 0000000..7b37cd1 --- /dev/null +++ b/src/push/instructions/numeric.rs @@ -0,0 +1,21 @@ +macro_rules! _add { + ($stack:ident) => { + paste::item! = { + pub fn [< $stack _add >] () + } + }; +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn add_test() { + let x = 1; + let y = 2; + + // let res = _add(&x, &y); + // assert_eq!(Some(3), res); + } +} diff --git a/src/push/mod.rs b/src/push/mod.rs new file mode 100644 index 0000000..f10e0df --- /dev/null +++ b/src/push/mod.rs @@ -0,0 +1,2 @@ +mod instructions; +mod state; diff --git a/src/push/state.rs b/src/push/state.rs new file mode 100644 index 0000000..2f8d8c8 --- /dev/null +++ b/src/push/state.rs @@ -0,0 +1,49 @@ +use rust_decimal::Decimal; + +pub enum Gene { + GeneInt(i128), + GeneFloat(Decimal), + GeneString(Vec), + GeneBool(bool), + GeneChar(char), + GeneVectorInt(Vec), + GeneVectorFloat(Vec), + GeneVectorString(Vec>), + GeneVectorBool(Vec), + GeneVectorChar(Vec), + // StateFunc(TODO) + Close, + Open(u8), + Skip, + Block(Vec), +} + +pub struct PushState { + pub int: Vec, + pub float: Vec, + pub string: Vec>, + pub bool: Vec, + pub char: Vec, + pub vector_int: Vec>, + pub vector_float: Vec>, + pub vector_string: Vec>>, + pub vector_bool: Vec>, + pub vector_char: Vec>, + pub code: Vec, + pub exec: Vec, +} + +pub const EMPTY_STATE: PushState = PushState { + int: vec![], + float: vec![], + string: vec![], + bool: vec![], + char: vec![], + vector_int: vec![], + vector_float: vec![], + vector_string: vec![], + vector_bool: vec![], + vector_char: vec![], + exec: vec![], + code: vec![], +};