|
|
|
@ -333,10 +333,10 @@ fn match_number(s: &str) -> Number {
|
|
|
|
|
pub fn compile_ast_ssa(
|
|
|
|
|
ast: Ast,
|
|
|
|
|
vars: &mut Vec<(String, String)>,
|
|
|
|
|
mut constants: &mut Vec<(String, String)>,
|
|
|
|
|
mut counter: &mut Box<i32>,
|
|
|
|
|
mut stack: &mut Vec<String>,
|
|
|
|
|
mut out: &mut Vec<(Option<String>, String)>,
|
|
|
|
|
constants: &mut Vec<(String, String)>,
|
|
|
|
|
counter: &mut Box<i32>,
|
|
|
|
|
stack: &mut Vec<String>,
|
|
|
|
|
out: &mut Vec<(Option<String>, String)>,
|
|
|
|
|
) {
|
|
|
|
|
match ast.clone().list() {
|
|
|
|
|
Some(l) => {
|
|
|
|
@ -356,10 +356,16 @@ pub fn compile_ast_ssa(
|
|
|
|
|
compile_ast_ssa(val, vars, constants, counter, stack, out);
|
|
|
|
|
let val_id = stack.pop().unwrap();
|
|
|
|
|
let ptr_id = stack.pop().unwrap();
|
|
|
|
|
out.push((None, format!("OpStore {} {}", fix_name(&val_id), fix_name(&ptr_id))));
|
|
|
|
|
out.push((
|
|
|
|
|
None,
|
|
|
|
|
format!("OpStore {} {}", fix_name(&val_id), fix_name(&ptr_id)),
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
s => {
|
|
|
|
|
panic!("Unknown function: {} with params {:#?} in context:\n{:#?}", s, lst, ast);
|
|
|
|
|
panic!(
|
|
|
|
|
"Unknown function: {} with params {:#?} in context:\n{:#?}",
|
|
|
|
|
s, lst, ast
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|