(* See [1] for the theory behind the analysis [1] https://fr.m.wiktionary.org/wiki/Annexe:Prononciation/fran%C3%A7ais#Structure_syllabique *) %parameter %{ module P = Process.M(T) %} %start main %% occlusiv: | P { T.p } | B { T.b } | T { T.t } | D { T.d } | K { T.k } | G { T.g } fricativ: | S { T.s () } | SZ { T.sz () } | Z { T.z () } | F { T.f } | X { T.ch () } obstruent: | occlusiv { $1 } | fricativ { $1 } liquid: | L { T.l () } | R { T.r () } nasal: | N { T.n } | M { T.m } consonant: | occlusiv { $1 } | fricativ { $1 } | liquid { $1 } | nasal { $1 } semi_voyel: | Y { T.none } | W { T.semi_voyel_w } opening_consonant: | occlusiv { $1, None } | fricativ { $1, None } | nasal { $1, None } | liquid { $1, None } | obstruent liquid { $1, Some $2 } | occlusiv fricativ { $1, Some $2 } | consonant semi_voyel{ $1, Some $2 } | semi_voyel { $1, None } (* Each voyel as two associated sounds, depending there is a followng sound or not *) voyels: | A { T.a , T.a } | A I { T.e `Opened , T.e `Opened } | I { T.i , T.i } | E { T.e `Opened , T.schwa () } | E_ACUTE E? { T.e `Closed , T.e `Closed } | E_AGRAVE { T.e `Opened , T.e `Opened } | E U { T.eu `Opened , T.eu `Opened } | O { T.o `Opened , T.o `Opened } | U { T.u , T.u } | OU { T.u' , T.u' } | W A { T.diphtongue T.semi_voyel_w T.a, T.diphtongue T.semi_voyel_w T.a} | W I { T.diphtongue T.semi_voyel_w T.i, T.diphtongue T.semi_voyel_w T.a} nasal_voyels: | A N { T.a' () , T.a' () } %prec Low ending_consonant: | B { Some (T.b ) } | S { Some (T.s ()) } | T { None } | R { Some (T.r ()) } | nasal { Some $1 } consonant_group: | opening_consonant { { ending = None ; opening = [ fst $1 ] ; following = snd $1 } } | ending_consonant opening_consonant { { ending = Some $1 ; opening = [ fst $2 ] ; following = snd $2 } } syllable: | c = consonant_group? v = voyels Sep? { (v, c) } syllables: | { [] } | ss = syllables s = syllable { s::ss } word: | syllables consonant_group? EOL { P.rebuild $2 $1 } main: | word { $1 }