stuck here

This commit is contained in:
Rowan Torbitzky-Lane 2025-04-09 13:48:39 -05:00
parent 6122c8dde7
commit f214aa7bd0
6 changed files with 76 additions and 0 deletions

1
src/lib.rs Normal file
View File

@ -0,0 +1 @@
mod push;

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,2 @@
mod instruction;
mod numeric;

View File

@ -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);
}
}

2
src/push/mod.rs Normal file
View File

@ -0,0 +1,2 @@
mod instructions;
mod state;

49
src/push/state.rs Normal file
View File

@ -0,0 +1,49 @@
use rust_decimal::Decimal;
pub enum Gene {
GeneInt(i128),
GeneFloat(Decimal),
GeneString(Vec<char>),
GeneBool(bool),
GeneChar(char),
GeneVectorInt(Vec<i128>),
GeneVectorFloat(Vec<Decimal>),
GeneVectorString(Vec<Vec<char>>),
GeneVectorBool(Vec<bool>),
GeneVectorChar(Vec<char>),
// StateFunc(TODO)
Close,
Open(u8),
Skip,
Block(Vec<Gene>),
}
pub struct PushState {
pub int: Vec<i128>,
pub float: Vec<Decimal>,
pub string: Vec<Vec<char>>,
pub bool: Vec<bool>,
pub char: Vec<char>,
pub vector_int: Vec<Vec<i128>>,
pub vector_float: Vec<Vec<Decimal>>,
pub vector_string: Vec<Vec<Vec<char>>>,
pub vector_bool: Vec<Vec<bool>>,
pub vector_char: Vec<Vec<char>>,
pub code: Vec<Gene>,
pub exec: Vec<Gene>,
}
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![],
};