Dia Ḋuit, Gꞃéagóiꞃ is ainm dom agus fáilte go dtí mo ṡuíoṁ gꞃéasáin

Programming as Gaeilge


This might appear a little left-field, but it's always surprised me how the morphology of the Irish language lends itself to programming constructs.

irish.svg

Before I continue, I should point out the inspiration for this post originated with Michal Měchura's excellent article here which touches on the same thoughts

The grammatical quirks of Irish

Irish or Gaeilge is an insular Celtic language spoken in, well, Ireland. From a grammatical perspective, it has some unusual traits that set it apart from other modern Indo-European languages.

Specifically its use of inflected prepositions, initial consonant mutations and verb-subject-object word ordering.

While these linguistic aspects can be difficult for language learners, they have certain analogies with programming.

The Copula - An Chopail

Irish in fact, has two verbs that correspond to the English "to be". One of which is called, "the copula" or is.

A copula is defined as a word that connects a subject and predicate in a relationship of equivalence, i.e. copulates

The copula is primarily used to describe identity or quality in a permanence sense. Depending on its usage, it's either termed a classifying copula or identifying copula.

Classification

The classifying copula construction is used to express a "class membership" relation in Irish.

Irish English
Is dochtúir é He is a doctor
Is múinteoir í She is a teacher
struct Múinteoir {};

int main()
{
    // classification: "í" (subject) belongs to class "múinteoir" (predicate)
    // i.e. "í" is an instance of the class "múinteoir"
    Múinteoir í;
}

Identification

The identifying copula construction is used to express a shared identity for the subject and predicate.

Irish English
Is é an dochtúir é He is the doctor
Is í an múinteoir an bhean The woman is the teacher
struct Identity {};

int main()
{
    // "í" identity object
    Identity í;

    // identification: "an_múinteoir" (predicate) and "an bhean" (subject) refer to same identity
    // i.e. both variables point to the same "í" object
    Identity *an_múinteoir, *an_bhean = &í;
}

Word ordering - Ord na bhfocal

Irish follows a verb -> subject -> object word ordering:

Verb Subject Object English
Múineann Gaeilge She teaches Irish

This unique word arrangement can coincidentally be interpreted to a function declaration:

struct Múinteoir {};

// verb(subject, object)
void múineann(Múinteoir múinteoir, std::string teanga) {};

int main()
{
    Múinteoir í;

    // "múineann" (verb) "(s)í" (subject) "gaeilge" (object)
    // word order preserved
    múineann(í, "gaeilge");
}

So not only does Irish satisfy the syntax of the programming language, it's also semantically and (almost) grammatically correct. Pretty cool.

To use the correct grammar, it should be "múineann gaeilge" using the subject form of the pronoun, , rather than the copula form í introduced earlier

Literally translating "múineann sí teanga" would be "teaches she Irish"

Prepositional Pronouns - Forainmneacha Réamhfhoclacha

Prepositions are words such as "with", "for", "at" or "on". Unlike a lot of other languages, these words can be conjugated (sometimes referred to as inflection) in Irish.

So a simple word like "on" can be translated to ar. And for ar we can make compound forms with personal pronouns like so:

Pronoun On
me orm
you ort
he air
she uirthi
us orainn
ye oraibh
them orthu
enum class ar { orm, ort, air, uirthi, orainn, oraibh, orthu };

void cuir(std::string object, ar pronoun) {};

int main()
{
    // "cuir" (verb) "agallamh" (object) "air" (pronoun)
    cuir("agallamh", ar::air);
}

As Michal Měchura pointed out in his article, Irish is strongly periphrastic. In other words, Irish places greater emphasis on multi-word constructions to convey meaning, rather than using verbs.

This is apparent in the example above, "cuir agallamh air" which literally translates to "put interview on him". Or in proper English, "interview him" in the imperative sense.

Conclusion - An Deireadh

I'm by no means a linguistic savant, so I hope I got all my terminology correct! But I enjoyed exploring how to translate Irish into a very different context.

It's interesting to see parallels between two unlikely subjects. There's probably even more grammatic forms that have equivalency that I haven't discovered yet.

Date: January 14th at 12:05pm

PREVIOUS NEXT