person.matzo 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. gender:= Male | Female | Unspec;
  2. byGender := { [m,f,n] => { [Male] => m; [Female] => f; [_] => n }};
  3. ending := byGender["o","a","e"];
  4. pronoun := byGender["he","she","they"];
  5. noun := byGender["man","woman","person"];
  6. are := byGender["is","is","are"];
  7. have := byGender["has", "has", "have"];
  8. cons ::= p t c d g r l m n x;
  9. vowel ::= a e i o u;
  10. name := { [g] => (vowel | "") rep[1..3, cons vowel] cons ending[g] };
  11. hairColor ::= black brown blonde;
  12. eyeColor ::= brown green blue;
  13. job := { [g] =>
  14. "stonemason"
  15. | "baker"
  16. | "accountant"
  17. | case g in
  18. { Male => "fisherman"
  19. ; Female => "fisherwoman"
  20. ; _ => "fisher"
  21. } };
  22. tool := { ["stonemason"] => "chisel"
  23. ; ["baker"] => "bowl"
  24. ; ["accountant"] => "tablet"
  25. ; [_] => "fishing pole"
  26. };
  27. adjective ::= happy cheerful focused quiet meek rash;
  28. person :=
  29. let fix my-gender := gender in {
  30. let fix my-job := job[my-gender] in {
  31. se[
  32. "You come across",
  33. str/capitalize[name[my-gender]],
  34. ", a",
  35. noun[my-gender],
  36. "from the city of",
  37. str/capitalize[name[Female]]
  38. "."
  39. ]
  40. " "
  41. se[
  42. pronoun[my-gender],
  43. are[my-gender],
  44. "a hardworking",
  45. my-job,
  46. "with",
  47. hairColor,
  48. "hair and",
  49. eyeColor,
  50. "eyes."
  51. ]
  52. " "
  53. se[
  54. pronoun[my-gender],
  55. have[my-gender],
  56. "a",
  57. tool[my-job],
  58. "and",
  59. are[my-gender],
  60. "very",
  61. adjective,
  62. "."
  63. ]
  64. } };
  65. puts person;