Get Started
- Clone SITER Repository with git:
git clone github.com/mxcoderr/SITER
SITER Example Usage:
use simple_ir_transformer::{IR, Value};
fn main() {
let ir_json = r#"
{
"imports": ["sys", "os"],
"var:my_variable": {
"value": "hello world"
},
"var:count": {
"value": 42
},
"var:is_active": {
"value": true
}
}
"#;
let ir = IR::new(ir_json.to_string());
for lang in ["Python", "JavaScript", "Lua"] {
println!("=== {} ===", lang);
match ir.transpile(lang) {
Ok(code) => println!("{}", code),
Err(e) => eprintln!("Error: {}", e),
}
}
}
Explanation
ir_json contains our IR. Then we create an instance of IR.
The instance has a transpile() method that returns generated code in the specified language:
ir.transpile("Python")— returns Python codeir.transpile("Lua")— returns Lua codeir.transpile("JavaScript")— returns JavaScript code
3. Running This Example
cargo run --release --example usage
Next Page
We recommend that you now go to the article about IR.