halfling_ipa.matzo 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. (* these should probably be part of the stdlib eventually *)
  2. flatten := {[t] => tuple/fold[{ [x, xs] => x xs }, "", t]};
  3. word := {[w] => flatten[tuple/map[orthography, w]]};
  4. wd := tuple/concat[<begin, middle, end>];
  5. middle := syll | tuple/concat[<syll, syll>] | tuple/concat[<syll, syll, syll>] | tuple/concat[<syll, syll, syll, syll>];
  6. syll := <cons, vowel>;
  7. end := <cons, vowel, final>
  8. | 2: <cons, ("eː" | "a"), final>
  9. | <"r"> | <"n"> ;
  10. orthography := { [x] => case x in
  11. { "z" => "s"
  12. ; "s" => "ss"
  13. ; "dz" => "z"
  14. ; "kʷ" => "qu"
  15. ; "k" => "c"
  16. ; "x" => "ch"
  17. ; "ʎ" => "lh"
  18. ; "ɲ" => "nh"
  19. ; "ʃ" => "sc"
  20. ; "ts" => "tz"
  21. ; "aː" => "á"
  22. ; "eː" => "é"
  23. ; "iː" => "í"
  24. ; "oː" => "ó"
  25. ; "uː" => "ú"
  26. ; "ɛ" => "è"
  27. ; "ɔ" => "o"
  28. ; "ɾ" => "r"
  29. ; "tɾ" => "tr"
  30. ; "ɾt" => "rt"
  31. ; _ => x
  32. } };
  33. begin := <vowel> | <initcons, vowel>;
  34. cons ::= b k d d x d f g g ɲ h j l l l ʎ m m m n n n
  35. p kʷ ɾ z z z s s s ʃ ʃ t t t tg tj ts ts tɾ ɾt v dz;
  36. initcons ::= b k d x d f g ɲ h j l m n p kʷ ɾ s ʃ t v;
  37. vowel := 4: commonvowel | uncommonvowel;
  38. commonvowel ::= a i u e eː o;
  39. uncommonvowel ::= aː ɛ oː ɔ iː uː;
  40. final := "s" | 6: "";
  41. fix wd;
  42. puts word[wd] " (pronounced /" flatten[wd] "/)";