Introduction
Renk is an indentation-based syntax for Rust, inspired by
Rust’s Ugly Syntax. renk
transpiles .rk files to Rust and converts Rust back to Renk.
#[derive(Debug, Clone)]
pub struct User:
pub id: u64
pub name: String
impl User:
pub fn new(id: u64, name: String) -> Self = Self{ id, name }
pub fn display_name(&self) -> &str = &self.name
pub fn main():
let user = User.new(1, "Ada".to_string())
println!("{user.display_name()}")
Generated Rust:
#[derive(Debug, Clone)]
pub struct User {
pub id: u64,
pub name: String,
}
impl User {
pub fn new(id: u64, name: String) -> Self {
Self{ id, name }
}
pub fn display_name(&self) -> &str {
&self.name
}
}
pub fn main() {
let user = User::new(1, "Ada".to_string());
println!("{}", user.display_name());
}
Renk changes syntax only. Types, borrowing, macros, and crates are Rust’s, and tokens the
transpiler does not rewrite pass through as Rust. A Rust { ... } block, a :: path, or a
::<T> turbofish is always accepted.