(* these should probably be part of the stdlib eventually *) flatten := {[t] => tuple/fold[{ [x, xs] => x xs }, "", t]}; word := {[w] => flatten[tuple/map[orthography, w]]}; wd := tuple/concat[]; middle := syll | tuple/concat[] | tuple/concat[] | tuple/concat[]; syll := ; end := | 2: | <"r"> | <"n"> ; orthography := { [x] => case x in { "z" => "s" ; "s" => "ss" ; "dz" => "z" ; "kʷ" => "qu" ; "k" => "c" ; "x" => "ch" ; "ʎ" => "lh" ; "ɲ" => "nh" ; "ʃ" => "sc" ; "ts" => "tz" ; "aː" => "á" ; "eː" => "é" ; "iː" => "í" ; "oː" => "ó" ; "uː" => "ú" ; "ɛ" => "è" ; "ɔ" => "o" ; "ɾ" => "r" ; "tɾ" => "tr" ; "ɾt" => "rt" ; _ => x } }; begin := | ; cons ::= b k d d x d f g g ɲ h j l l l ʎ m m m n n n p kʷ ɾ z z z s s s ʃ ʃ t t t tg tj ts ts tɾ ɾt v dz; initcons ::= b k d x d f g ɲ h j l m n p kʷ ɾ s ʃ t v; vowel := 4: commonvowel | uncommonvowel; commonvowel ::= a i u e eː o; uncommonvowel ::= aː ɛ oː ɔ iː uː; final := "s" | 6: ""; fix wd; puts word[wd] " (pronounced /" flatten[wd] "/)";