mod mem;
mod engine;

#[no_mangle]
pub unsafe fn eval(ptr: *mut u8) -> *mut u8 {
    let js = mem::read_string(ptr);
    let eval_result = engine::inner_eval(&js);
    let eval_result_json_string = serde_json::to_string(&eval_result).expect("SHOULD NOT HAPPEN");
    mem::malloc_and_write_string(&eval_result_json_string).0
}

