Skip to content

Latest commit

 

History

History
108 lines (89 loc) · 4.19 KB

README.md

File metadata and controls

108 lines (89 loc) · 4.19 KB

hrđa

Hrdja Logo

Aren't you umorni from writing Rust programs in English? Do you like saying "razlaz" a lot? Would you like to try something different, in an exotic and funny-sounding language? Would you want to bring some Croatian touch to your programs?

hrđa (Croatian for Rust) is here to save your day, as it allows you to write Rust programs in Croatian, using Croatian keywords, Croatian function names, Croatian idioms.

This has been designed to be used as the official programming language to develop the future Croatian sovereign software.

If you're from the Croatian or any other governement with Croatian as an official language: I will be awaiting your donations on liberapay.

Don't worry! Croatian Rust is fully compatible with English Rust, so you can mix both at your convenience.

Here's an example of what can be achieved with Hrđa:

trait and impl (aka svojstvo i ispuna)

hrđa::hrđa! {
    koristi std::collections::KartaSažetaka kao Rječnik;

    svojstvo KljučVrijednost {
        fn napiši(&suština, ključ: ZnakovniNiz, valeur: ZnakovniNiz);
        fn dohvati(&suština, ključ: ZnakovniNiz) -> Rezultat<Neobavezno<&ZnakovniNiz>, ZnakovniNiz>;
    }

    nepokretno izmjenjiv RJECNIK: Neobavezno<Rječnik<ZnakovniNiz, ZnakovniNiz>> = Nijedan;

    građa GPKrk;

    ispuna KljučVrijednost za GPKrk {
        fn napiši(&suština, ključ: ZnakovniNiz, valeur: ZnakovniNiz) {
            dopusti rjecnik = opasno {
                RJECNIK.dohvati_ili_ubaci_uz(Podrazumijevano::podrazumijevano)
            };
            rjecnik.ubaci(ključ, valeur);
        }
        fn dohvati(&suština, ključ: ZnakovniNiz) -> Rezultat<Neobavezno<&ZnakovniNiz>, ZnakovniNiz> {
            ako dopusti Neki(rjecnik) = opasno { RJECNIK.ko_upuć() } {
                URedu(rjecnik.dohvati(&ključ))
            } inače {
                Kiks("dohvati rjecnik".pretvori())
            }
        }
    }
}

Support for regional languages

#[dopusti(izvor_nedostupan)]
fn sekundarni() {
    panika!("o ne"); // for the usual Croatian experience
    razlaz!("gasi to"); // a student party broken up
    racija!("nemoj, Milane"); // time to give a cut of the rakija
}

Other examples

See the examples to get a rough sense of the whole syntax.

Other languages