oakc 0.6.1

A portable programming language with a compact backend
Documentation
#[std]

// The number of memory cells the `Date` type consumes
struct Date {
    let month: num,
        day: num,
        year: num;

    fn new(month: num, day: num, year: num) -> Date {
        return [month, day, year]
    }

    fn birthday() -> Date {
        return Date::new(5, 14, 2002);
    }
    
    fn tomorrow(self: &Date)  { self->day = self->day + 1; }
    fn yesterday(self: &Date) { self->day = self->day - 1; }

    fn next_week(self: &Date) {
        for i in 0..7 {
            self.tomorrow();
        }
    }

    fn print(self: &Date, is_american: bool) {
        if is_american {
            prn!(self->month); prc!('/');
            prn!(self->day); prc!('/');
            prn!(self->year); 
        } else {
            prn!(self->day); prc!('/');
            prn!(self->month); prc!('/');
            prn!(self->year); 
        }
    }

    fn println(self: &Date, is_american: bool) { self.print(is_american); prend!(); }
}

fn main() {
    let bday: Date = Date::birthday();

    bday.println(true); // American
    bday.println(false); // Non-American
    
    // Increment the day value
    bday.tomorrow();
    
    bday.println(true); // American
    bday.println(false); // Non-American
    
    // Increment the day value seven times
    bday.next_week();

    bday.println(true); // American
    bday.println(false); // Non-American
}