stuck here
This commit is contained in:
parent
6122c8dde7
commit
f214aa7bd0
1
src/lib.rs
Normal file
1
src/lib.rs
Normal file
@ -0,0 +1 @@
|
||||
mod push;
|
1
src/push/instructions/instruction.rs
Normal file
1
src/push/instructions/instruction.rs
Normal file
@ -0,0 +1 @@
|
||||
|
2
src/push/instructions/mod.rs
Normal file
2
src/push/instructions/mod.rs
Normal file
@ -0,0 +1,2 @@
|
||||
mod instruction;
|
||||
mod numeric;
|
21
src/push/instructions/numeric.rs
Normal file
21
src/push/instructions/numeric.rs
Normal 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
2
src/push/mod.rs
Normal file
@ -0,0 +1,2 @@
|
||||
mod instructions;
|
||||
mod state;
|
49
src/push/state.rs
Normal file
49
src/push/state.rs
Normal 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![],
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user