eignnx / affix-grammar

An affix-grammar format and sentence generator.
Mozilla Public License 2.0
0 stars 0 forks source link

impl algebraic data types #15

Open eignnx opened 4 years ago

eignnx commented 4 years ago

data variants could be more expressive if they were full algebraic data types. this entails:

Example

data List.T = cons.T | nil

data GrammaticalTense = past | present | future
data GrammaticalAspect = simple | progressive | perfect | perfect_progressive
data FullTense = tense.GrammaticalTense.GrammaticalAspect

data GrammaticalPerson = 1st | 2nd | 3rd
data GrammaticalNumber = singular | plural
data GrammaticalGender = neutral | nonbinary | feminine | masculine
data FullPerson = person.GrammaticalPerson.GrammaticalNumber.GrammaticalGender

data EnglishPerson = i | you | it | she | he | we | yall | they

rule are.FullTense.FullPerson =
  .(tense.present.simple).* -> ""
  .(tense.past.simple) {
    .(person.Person.Number.Gender) -> "was"

rule eat.FullTense.FullPerson =
  .(tense.present.simple) {
    .(person.3rd.singular).nonbinary -> "eat"
    .(person.3rd.singular).* -> "eats"
    .(person.*.*).* -> "eat"
  }
  .(tense.present.progressive) {
    .(person.3rd.singular).nonbinary -> "are eating"
    .(person.3rd.singular).* -> "is eating"
    .(person.1st.singular).* -> "am eating"
    .(person.*.*).* -> "are eating"
  }

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP