Compare commits
No commits in common. "17eaeb1a2f5e91b8e29af6f807cced3595596ed5" and "30b608e5aa8a449a688fab408715d1afb60050ce" have entirely different histories.
17eaeb1a2f
...
30b608e5aa
4 changed files with 38 additions and 380 deletions
|
@ -31,8 +31,8 @@ pub enum Arg {
|
||||||
impl assembler::ToCode for Arg {
|
impl assembler::ToCode for Arg {
|
||||||
fn to_code(&self) -> String {
|
fn to_code(&self) -> String {
|
||||||
match self {
|
match self {
|
||||||
Arg::Char(x) => format!("'{}'", x.escape_default()),
|
Arg::Char(x) => format!("'{}'", x),
|
||||||
Arg::String(x) => format!("\"{}\"", x.escape_default()),
|
Arg::String(x) => format!("\"{}\"", x),
|
||||||
Arg::Number(x) => x.to_string(),
|
Arg::Number(x) => x.to_string(),
|
||||||
Arg::Variable(x) => x.clone(),
|
Arg::Variable(x) => x.clone(),
|
||||||
Arg::BinaryExpression { left, right, op } => {
|
Arg::BinaryExpression { left, right, op } => {
|
||||||
|
|
|
@ -1 +1,13 @@
|
||||||
random . cr
|
asm"
|
||||||
|
.std_get MEM_ALLOC_PTR
|
||||||
|
tls
|
||||||
|
dbg
|
||||||
|
pop
|
||||||
|
"
|
||||||
|
3 cells allot
|
||||||
|
asm"
|
||||||
|
.std_get MEM_ALLOC_PTR
|
||||||
|
tls
|
||||||
|
dbg
|
||||||
|
pop
|
||||||
|
"
|
||||||
|
|
|
@ -128,7 +128,7 @@ impl Data {
|
||||||
hence::parser::ast::Node::MacroCall {
|
hence::parser::ast::Node::MacroCall {
|
||||||
name: "define".to_string(),
|
name: "define".to_string(),
|
||||||
args: vec![
|
args: vec![
|
||||||
hence::arg::Arg::Variable("MEM_LOOP_I".to_string()),
|
hence::arg::Arg::Variable("MEM_ALLOC_PTR".to_string()),
|
||||||
hence::arg::Arg::BinaryExpression {
|
hence::arg::Arg::BinaryExpression {
|
||||||
left: Box::new(hence::arg::Arg::Variable("CORE_MEM_MEM".to_string())),
|
left: Box::new(hence::arg::Arg::Variable("CORE_MEM_MEM".to_string())),
|
||||||
right: Box::new(hence::arg::Arg::Number(16)),
|
right: Box::new(hence::arg::Arg::Number(16)),
|
||||||
|
@ -136,28 +136,6 @@ impl Data {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "define".to_string(),
|
|
||||||
args: vec![
|
|
||||||
hence::arg::Arg::Variable("MEM_LOOP_J".to_string()),
|
|
||||||
hence::arg::Arg::BinaryExpression {
|
|
||||||
left: Box::new(hence::arg::Arg::Variable("MEM_LOOP_I".to_string())),
|
|
||||||
right: Box::new(hence::arg::Arg::Number(1)),
|
|
||||||
op: hence::arg::BinaryExpressionOperator::Add,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "define".to_string(),
|
|
||||||
args: vec![
|
|
||||||
hence::arg::Arg::Variable("MEM_ALLOC_PTR".to_string()),
|
|
||||||
hence::arg::Arg::BinaryExpression {
|
|
||||||
left: Box::new(hence::arg::Arg::Variable("MEM_LOOP_J".to_string())),
|
|
||||||
right: Box::new(hence::arg::Arg::Number(1)),
|
|
||||||
op: hence::arg::BinaryExpressionOperator::Add,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
// macros
|
// macros
|
||||||
// stack_transfer_alu
|
// stack_transfer_alu
|
||||||
hence::parser::ast::Node::MacroCall {
|
hence::parser::ast::Node::MacroCall {
|
||||||
|
|
|
@ -53,7 +53,6 @@ pub enum Instruction {
|
||||||
Max,
|
Max,
|
||||||
Boolean,
|
Boolean,
|
||||||
Invert,
|
Invert,
|
||||||
Random,
|
|
||||||
Plus,
|
Plus,
|
||||||
OnePlus,
|
OnePlus,
|
||||||
TwoPlus,
|
TwoPlus,
|
||||||
|
@ -122,7 +121,6 @@ impl Instruction {
|
||||||
"max" => Some(Instruction::Max),
|
"max" => Some(Instruction::Max),
|
||||||
"boolean" => Some(Instruction::Boolean),
|
"boolean" => Some(Instruction::Boolean),
|
||||||
"invert" => Some(Instruction::Invert),
|
"invert" => Some(Instruction::Invert),
|
||||||
"random" => Some(Instruction::Random),
|
|
||||||
"+" => Some(Instruction::Plus),
|
"+" => Some(Instruction::Plus),
|
||||||
"1+" => Some(Instruction::OnePlus),
|
"1+" => Some(Instruction::OnePlus),
|
||||||
"2+" => Some(Instruction::TwoPlus),
|
"2+" => Some(Instruction::TwoPlus),
|
||||||
|
@ -363,26 +361,8 @@ impl compiler::Compilable<compiler::Data, hence::parser::ast::Body> for Instruct
|
||||||
arg: None,
|
arg: None,
|
||||||
},
|
},
|
||||||
]),
|
]),
|
||||||
Instruction::I => Ok(vec![
|
Instruction::I => Ok(vec![]),
|
||||||
hence::parser::ast::Node::MacroCall {
|
Instruction::J => Ok(vec![]),
|
||||||
name: "std_get".to_string(),
|
|
||||||
args: vec![hence::arg::Arg::Variable("MEM_LOOP_I".to_string())],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tls".to_string(),
|
|
||||||
arg: None,
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
Instruction::J => Ok(vec![
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "std_get".to_string(),
|
|
||||||
args: vec![hence::arg::Arg::Variable("MEM_LOOP_J".to_string())],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tls".to_string(),
|
|
||||||
arg: None,
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
Instruction::Tuck => Ok(vec![
|
Instruction::Tuck => Ok(vec![
|
||||||
hence::parser::ast::Node::MacroCall {
|
hence::parser::ast::Node::MacroCall {
|
||||||
name: "std_ld".to_string(),
|
name: "std_ld".to_string(),
|
||||||
|
@ -631,7 +611,7 @@ impl compiler::Compilable<compiler::Data, hence::parser::ast::Body> for Instruct
|
||||||
name: "std_rset".to_string(),
|
name: "std_rset".to_string(),
|
||||||
args: vec![
|
args: vec![
|
||||||
hence::arg::Arg::Variable("CORE_REG_A".to_string()),
|
hence::arg::Arg::Variable("CORE_REG_A".to_string()),
|
||||||
hence::arg::Arg::Char(' '),
|
hence::arg::Arg::Char('\n'),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
hence::parser::ast::Node::MacroCall {
|
hence::parser::ast::Node::MacroCall {
|
||||||
|
@ -645,7 +625,7 @@ impl compiler::Compilable<compiler::Data, hence::parser::ast::Body> for Instruct
|
||||||
name: "std_rset".to_string(),
|
name: "std_rset".to_string(),
|
||||||
args: vec![
|
args: vec![
|
||||||
hence::arg::Arg::Variable("CORE_REG_A".to_string()),
|
hence::arg::Arg::Variable("CORE_REG_A".to_string()),
|
||||||
hence::arg::Arg::Char('\n'),
|
hence::arg::Arg::Number(0x0a),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
hence::parser::ast::Node::MacroCall {
|
hence::parser::ast::Node::MacroCall {
|
||||||
|
@ -720,314 +700,26 @@ impl compiler::Compilable<compiler::Data, hence::parser::ast::Body> for Instruct
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
Instruction::Count => Ok(vec![]),
|
Instruction::Count => Ok(vec![]),
|
||||||
Instruction::Not => Ok(vec![
|
Instruction::Not => Ok(vec![]),
|
||||||
hence::parser::ast::Node::MacroCall {
|
Instruction::And => Ok(vec![]),
|
||||||
name: "std_ld".to_string(),
|
Instruction::Nand => Ok(vec![]),
|
||||||
args: vec![],
|
Instruction::Or => Ok(vec![]),
|
||||||
},
|
Instruction::Nor => Ok(vec![]),
|
||||||
hence::parser::ast::Node::Call {
|
Instruction::Xor => Ok(vec![]),
|
||||||
name: "tlr".to_string(),
|
Instruction::Xnor => Ok(vec![]),
|
||||||
arg: Some(hence::arg::Arg::Variable("CORE_REG_A".to_string())),
|
Instruction::Lsh => Ok(vec![]),
|
||||||
},
|
Instruction::Rsh => Ok(vec![]),
|
||||||
hence::parser::ast::Node::MacroCall {
|
Instruction::Compare => Ok(vec![]),
|
||||||
name: "std_alu".to_string(),
|
Instruction::Eq => Ok(vec![]),
|
||||||
args: vec![hence::arg::Arg::Variable("CORE_ALU_NOT".to_string())],
|
Instruction::Neq => Ok(vec![]),
|
||||||
},
|
Instruction::Lt => Ok(vec![]),
|
||||||
hence::parser::ast::Node::Call {
|
Instruction::Leq => Ok(vec![]),
|
||||||
name: "tls".to_string(),
|
Instruction::Gt => Ok(vec![]),
|
||||||
arg: None,
|
Instruction::Geq => Ok(vec![]),
|
||||||
},
|
|
||||||
]),
|
|
||||||
Instruction::And => Ok(vec![
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "stack_transfer_alu".to_string(),
|
|
||||||
args: vec![],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "std_alu".to_string(),
|
|
||||||
args: vec![hence::arg::Arg::Variable("CORE_ALU_AND".to_string())],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tls".to_string(),
|
|
||||||
arg: None,
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
Instruction::Nand => Ok(vec![
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "stack_transfer_alu".to_string(),
|
|
||||||
args: vec![],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "std_alu".to_string(),
|
|
||||||
args: vec![hence::arg::Arg::Variable("CORE_ALU_AND".to_string())],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tlr".to_string(),
|
|
||||||
arg: Some(hence::arg::Arg::Variable("CORE_REG_A".to_string())),
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "std_alu".to_string(),
|
|
||||||
args: vec![hence::arg::Arg::Variable("CORE_ALU_NOT".to_string())],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tls".to_string(),
|
|
||||||
arg: None,
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
Instruction::Or => Ok(vec![
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "stack_transfer_alu".to_string(),
|
|
||||||
args: vec![],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "std_alu".to_string(),
|
|
||||||
args: vec![hence::arg::Arg::Variable("CORE_ALU_OR".to_string())],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tls".to_string(),
|
|
||||||
arg: None,
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
Instruction::Nor => Ok(vec![
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "stack_transfer_alu".to_string(),
|
|
||||||
args: vec![],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "std_alu".to_string(),
|
|
||||||
args: vec![hence::arg::Arg::Variable("CORE_ALU_OR".to_string())],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tlr".to_string(),
|
|
||||||
arg: Some(hence::arg::Arg::Variable("CORE_REG_A".to_string())),
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "std_alu".to_string(),
|
|
||||||
args: vec![hence::arg::Arg::Variable("CORE_ALU_NOT".to_string())],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tls".to_string(),
|
|
||||||
arg: None,
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
Instruction::Xor => Ok(vec![
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "stack_transfer_alu".to_string(),
|
|
||||||
args: vec![],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "std_alu".to_string(),
|
|
||||||
args: vec![hence::arg::Arg::Variable("CORE_ALU_XOR".to_string())],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tls".to_string(),
|
|
||||||
arg: None,
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
Instruction::Xnor => Ok(vec![
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "stack_transfer_alu".to_string(),
|
|
||||||
args: vec![],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "std_alu".to_string(),
|
|
||||||
args: vec![hence::arg::Arg::Variable("CORE_ALU_XOR".to_string())],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tlr".to_string(),
|
|
||||||
arg: Some(hence::arg::Arg::Variable("CORE_REG_A".to_string())),
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "std_alu".to_string(),
|
|
||||||
args: vec![hence::arg::Arg::Variable("CORE_ALU_NOT".to_string())],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tls".to_string(),
|
|
||||||
arg: None,
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
Instruction::Lsh => Ok(vec![
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "stack_transfer_alu".to_string(),
|
|
||||||
args: vec![],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "std_alu".to_string(),
|
|
||||||
args: vec![hence::arg::Arg::Variable("CORE_ALU_LSH".to_string())],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tls".to_string(),
|
|
||||||
arg: None,
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
Instruction::Rsh => Ok(vec![
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "stack_transfer_alu".to_string(),
|
|
||||||
args: vec![],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "std_alu".to_string(),
|
|
||||||
args: vec![hence::arg::Arg::Variable("CORE_ALU_RSH".to_string())],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tls".to_string(),
|
|
||||||
arg: None,
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
Instruction::Compare => Ok(vec![
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "stack_transfer_alu".to_string(),
|
|
||||||
args: vec![],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "std_alu".to_string(),
|
|
||||||
args: vec![hence::arg::Arg::Variable("CORE_ALU_CMP".to_string())],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tls".to_string(),
|
|
||||||
arg: None,
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
Instruction::Eq => Ok(vec![
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "stack_transfer_alu".to_string(),
|
|
||||||
args: vec![],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "std_alu".to_string(),
|
|
||||||
args: vec![hence::arg::Arg::Variable("CORE_ALU_EQ".to_string())],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tls".to_string(),
|
|
||||||
arg: None,
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
Instruction::Neq => Ok(vec![
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "stack_transfer_alu".to_string(),
|
|
||||||
args: vec![],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "std_alu".to_string(),
|
|
||||||
args: vec![hence::arg::Arg::Variable("CORE_ALU_EQ".to_string())],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tlr".to_string(),
|
|
||||||
arg: Some(hence::arg::Arg::Variable("CORE_REG_A".to_string())),
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "std_alu".to_string(),
|
|
||||||
args: vec![hence::arg::Arg::Variable("CORE_ALU_INV".to_string())],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tls".to_string(),
|
|
||||||
arg: None,
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
Instruction::Lt => Ok(vec![
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "stack_transfer_alu".to_string(),
|
|
||||||
args: vec![],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "std_alu".to_string(),
|
|
||||||
args: vec![hence::arg::Arg::Variable("CORE_ALU_LT".to_string())],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tls".to_string(),
|
|
||||||
arg: None,
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
Instruction::Leq => Ok(vec![
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "stack_transfer_alu".to_string(),
|
|
||||||
args: vec![],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "std_alu".to_string(),
|
|
||||||
args: vec![hence::arg::Arg::Variable("CORE_ALU_LEQ".to_string())],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tls".to_string(),
|
|
||||||
arg: None,
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
Instruction::Gt => Ok(vec![
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "stack_transfer_alu".to_string(),
|
|
||||||
args: vec![],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "std_alu".to_string(),
|
|
||||||
args: vec![hence::arg::Arg::Variable("CORE_ALU_GT".to_string())],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tls".to_string(),
|
|
||||||
arg: None,
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
Instruction::Geq => Ok(vec![
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "stack_transfer_alu".to_string(),
|
|
||||||
args: vec![],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "std_alu".to_string(),
|
|
||||||
args: vec![hence::arg::Arg::Variable("CORE_ALU_GEQ".to_string())],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tls".to_string(),
|
|
||||||
arg: None,
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
Instruction::Min => Ok(vec![]),
|
Instruction::Min => Ok(vec![]),
|
||||||
Instruction::Max => Ok(vec![]),
|
Instruction::Max => Ok(vec![]),
|
||||||
Instruction::Boolean => Ok(vec![
|
Instruction::Boolean => Ok(vec![]),
|
||||||
hence::parser::ast::Node::MacroCall {
|
Instruction::Invert => Ok(vec![]),
|
||||||
name: "std_ld".to_string(),
|
|
||||||
args: vec![],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tlr".to_string(),
|
|
||||||
arg: Some(hence::arg::Arg::Variable("CORE_REG_A".to_string())),
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "std_alu".to_string(),
|
|
||||||
args: vec![hence::arg::Arg::Variable("CORE_ALU_BOL".to_string())],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tls".to_string(),
|
|
||||||
arg: None,
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
Instruction::Invert => Ok(vec![
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "std_ld".to_string(),
|
|
||||||
args: vec![],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tlr".to_string(),
|
|
||||||
arg: Some(hence::arg::Arg::Variable("CORE_REG_A".to_string())),
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "std_alu".to_string(),
|
|
||||||
args: vec![hence::arg::Arg::Variable("CORE_ALU_INV".to_string())],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tls".to_string(),
|
|
||||||
arg: None,
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
Instruction::Random => Ok(vec![
|
|
||||||
hence::parser::ast::Node::MacroCall {
|
|
||||||
name: "std_alu".to_string(),
|
|
||||||
args: vec![hence::arg::Arg::Variable("CORE_ALU_RND".to_string())],
|
|
||||||
},
|
|
||||||
hence::parser::ast::Node::Call {
|
|
||||||
name: "tls".to_string(),
|
|
||||||
arg: None,
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
Instruction::Plus => Ok(vec![
|
Instruction::Plus => Ok(vec![
|
||||||
hence::parser::ast::Node::MacroCall {
|
hence::parser::ast::Node::MacroCall {
|
||||||
name: "stack_transfer_alu".to_string(),
|
name: "stack_transfer_alu".to_string(),
|
||||||
|
@ -1353,30 +1045,6 @@ impl compiler::Compilable<compiler::Data, hence::parser::ast::Body> for Instruct
|
||||||
}],
|
}],
|
||||||
]
|
]
|
||||||
.concat()),
|
.concat()),
|
||||||
Instruction::I | Instruction::J => Ok([
|
|
||||||
instruction.compile(data)?,
|
|
||||||
[hence::parser::ast::Node::Call {
|
|
||||||
name: "tls".to_string(),
|
|
||||||
arg: None,
|
|
||||||
}]
|
|
||||||
.into_iter()
|
|
||||||
.cycle()
|
|
||||||
.take(count - 1)
|
|
||||||
.collect(),
|
|
||||||
]
|
|
||||||
.concat()),
|
|
||||||
Instruction::Space | Instruction::Cr => Ok([
|
|
||||||
instruction.compile(data)?,
|
|
||||||
[hence::parser::ast::Node::Call {
|
|
||||||
name: "set".to_string(),
|
|
||||||
arg: None,
|
|
||||||
}]
|
|
||||||
.into_iter()
|
|
||||||
.cycle()
|
|
||||||
.take(count - 1)
|
|
||||||
.collect(),
|
|
||||||
]
|
|
||||||
.concat()),
|
|
||||||
_ => {
|
_ => {
|
||||||
let compiled = instruction.compile(data)?;
|
let compiled = instruction.compile(data)?;
|
||||||
let len = compiled.len() * count;
|
let len = compiled.len() * count;
|
||||||
|
|
Loading…
Reference in a new issue