1mod c;
2pub use c::C;
3mod go;
4pub use go::Go;
5mod ts;
6pub use ts::TS;
7
8pub trait Target {
9 fn get_name(&self) -> char;
10
11 fn std(&self) -> String;
12 fn core_prelude(&self) -> String;
13 fn core_postlude(&self) -> String;
14
15 fn begin_entry_point(&self, global_scope_size: i32, memory_size: i32) -> String;
16 fn end_entry_point(&self) -> String;
17
18 fn establish_stack_frame(&self, arg_size: i32, local_scope_size: i32) -> String;
19 fn end_stack_frame(&self, return_size: i32, local_scope_size: i32) -> String;
20 fn load_base_ptr(&self) -> String;
21
22 fn push(&self, n: f64) -> String;
23
24 fn add(&self) -> String;
25 fn subtract(&self) -> String;
26 fn multiply(&self) -> String;
27 fn divide(&self) -> String;
28 fn sign(&self) -> String;
29
30 fn allocate(&self) -> String;
31 fn free(&self) -> String;
32 fn store(&self, size: i32) -> String;
33 fn load(&self, size: i32) -> String;
34
35 fn fn_header(&self, name: String) -> String;
36 fn fn_definition(&self, name: String, body: String) -> String;
37 fn call_fn(&self, name: String) -> String;
38 fn call_foreign_fn(&self, name: String) -> String;
39
40 fn begin_while(&self) -> String;
41 fn end_while(&self) -> String;
42
43 fn compile(&self, code: String) -> std::io::Result<()>;
44}