mirror of
https://forge.katzen.cafe/katzen-cafe/iowo.git
synced 2026-01-16 16:43:05 +01:00
basic conversion thing do worky!!!
This commit is contained in:
parent
f046393af8
commit
b92977d8f1
13 changed files with 680 additions and 14 deletions
|
|
@ -1,14 +1,38 @@
|
|||
pub fn add(left: usize, right: usize) -> usize {
|
||||
left + right
|
||||
use rpl::instructions::Instruction;
|
||||
use value::DynamicValue;
|
||||
|
||||
mod debug;
|
||||
mod value;
|
||||
|
||||
/// The available executors
|
||||
/// unused in early dev.
|
||||
#[derive(Debug, Clone, Copy, clap::ValueEnum)]
|
||||
pub enum Executors {
|
||||
/// the debug executor is single threaded and really, *really* slow. And unstable. Don't use. Unless you're a dev working on this.
|
||||
Debug,
|
||||
/// the CPU executor primarily uses the CPU. Most likely most feature complete, and the fallback.
|
||||
Cpu,
|
||||
/// the Vulkan executor (obviously) uses vulkan. there's a good chance this isn't implemented yet as you're reading this.
|
||||
Vulkan,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
trait Executor {
|
||||
fn execute(instruction: Instruction, input: Option<DynamicValue>) -> Option<DynamicValue>;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn it_works() {
|
||||
let result = add(2, 2);
|
||||
assert_eq!(result, 4);
|
||||
pub fn execute_all(instructions: Vec<Instruction>) {
|
||||
let mut tmp = None;
|
||||
|
||||
for instruction in instructions {
|
||||
tmp = debug::DebugExecutor::execute(instruction, tmp);
|
||||
}
|
||||
}
|
||||
|
||||
// scratchpad lol:
|
||||
// execution structure:
|
||||
// 1. take in rpl
|
||||
// 2. analyse/validate structure against allowed executors
|
||||
// 3. assign executors to instructions
|
||||
// 4. optimize
|
||||
// 5. prepare memory management patterns
|
||||
// 6. run
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue