Try   HackMD

Notes on GF Lab (German)

follows these notes

abstract Hello = {

flags coding = utf8 ;

flags startcat = Greeting;

cat
   Adjective; Greeting; Recipient;

fun
    Hello : Recipient -> Greeting;
    Welcome : Recipient -> Greeting;
    RecipPhrase : Adjective -> Recipient -> Recipient;
    Friends : Recipient;
    Mom : Recipient;
    World : Recipient;
    Awesome : Adjective;
    Happy : Adjective;

}
concrete HelloEng of Hello = {

flags coding = utf8 ;

lincat
    Greeting = {s : Str};
    Recipient = {s : Str};
    Adjective = {s : Str};

lin
    Hello recip = {s = "hello" ++ recip.s};
    Welcome recip = {s = "welcome" ++ recip.s};
    World  = {s = "world"};
    Mom  = {s = "mom"};
    Friends  = {s = "friends"};
    RecipPhrase adj recip = {s = adj.s ++ recip.s};
    Awesome  = {s = "awesome"};
    Happy  = {s = "happy"};

}
concrete HelloSpa of Hello = {

flags coding = utf8 ;

lincat
    Adjective = {s : Gender => Str};
    Greeting = {s : Str};
    Recipient = {s : Str; g : Gender};

lin
    Hello recip = {s = "hola" ++ recip.s};
    Welcome recip = {s = "bienvenidos" ++ recip.s};
    World  = {s = "mundo"; g = Masc Sg};
    Mom  = {s = "mamá"; g = Fem Sg};
    Friends  = {s = "amigos"; g = Masc Pl};
    RecipPhrase adj recip = {s = recip.s ++ adj.s ! recip.g; g = recip.g};
    Awesome  = {s = table {
       Masc Sg => "maravilloso";
       Masc Pl => "maravillosos";
       Fem Sg => "maravillosa";
       Fem Pl => "maravillosas"
     }};
    Happy  = {s = table {
       Masc Sg => "alegre";
       Masc Pl => "alegres";
       Fem Sg => "alegre";
       Fem Pl => "alegres"
     }};

param
    Number = Sg | Pl;
    Gender = Masc Number | Fem Number;

}
concrete HelloGer of Hello = {

flags coding = utf8 ;

lincat
    Adjective = {s : Gender => Str};
    Greeting = {s : Str};
    Recipient = {s : Str; g : Gender};

lin
    Hello recip = {s = "Hallo" ++ recip.s};
    Welcome recip = {s = "Willkommen" ++ recip.s};
    World  = {s = "Welt"; g = Fem Sg};
    Mom  = {s = "Mama"; g = Fem Sg};
    Friends  = {s = "Freunde"; g = Masc Pl};
    RecipPhrase adj recip = {s = (adj.s ! recip.g) ++ recip.s ; g = recip.g};
    Awesome  = {s = table {
       Masc Sg => "wunderbarer";
       Masc Pl => "wunderbare";
       Fem Sg => "wunderbare";
       Fem Pl => "wunderbare"
     }};
    Happy  = {s = table {
       Masc Sg => "freundlicher";
       Masc Pl => "freundliche";
       Fem Sg => "freundliche";
       Fem Pl => "freundliche"
     }};

param
    Number = Sg | Pl;
    Gender = Masc Number | Fem Number;

}