%{ (** This module transform the words into a semi-prononciation elements. The letters should be quite close with the associate phonem, but some modification can occur. *) open Tokens let letter_e = function | Accent.NONE -> Tokens.E | Accent.AGRAVE -> Tokens.E_AGRAVE | Accent.ACUTE -> Tokens.E_ACUTE %} %token X_ %token ENT_ %token ERF_ %token EL_ %token IENT_ %token Sep %token A %token B %token C %token D %token E %token F %token G %token H %token I %token J %token K %token L %token M %token N %token O %token Q %token P %token R %token S %token T %token U %token V %token W (* semi voyel w *) %token X %token Y (* semi voyel j *) %token Z %token Space %token EOL %nonassoc Low %left R %right High %start main %% voyel : A { A } | E { letter_e $1 } | I { I } | O { O } | A U { O } | E A U { O } | O U { OU } | U { U } letters : voyel { $1 :: [] } | Space { Space :: [] } | Sep { Sep :: [] } | B { B :: [] } | C { K :: [] } | C H { X :: [] } | C I { S :: I :: [] } | C E { S :: letter_e $2 :: [] } | C U { K :: U :: [] } | C U I { K :: I :: [] } | C U E { K :: E :: [] } | D { D :: [] } | D D { D :: [] } | F { F :: [] } | G { G :: [] } | G I { J :: I :: [] } | G E { J :: letter_e $2 :: [] } | G E voyel { J :: $3 :: [] } | G U { G :: U :: [] } | G U I { G :: I :: [] } | G U E { G :: letter_e $3 :: [] } | H { Sep :: [] } | J { J :: [] } | K { K :: [] } | E L { letter_e $1 :: L :: [] } | E L L { E_AGRAVE :: L :: [] } | I L { I :: L :: [] } | I L L { I :: Y :: [] } | L { L :: [] } | M { M :: [] } | M M { M :: [] } | N { N :: [] } | N N { N :: [] } | O I { W :: A :: [] } | O I N { W :: I :: N :: [] } | P { P :: [] } | Q { K :: [] } | Q U { K :: [] } | R { R :: [] } | S { SZ :: [] } | S S { S :: [] } | S H { X :: [] } | T { T :: [] } | V { V :: [] } | W { W :: [] } | X { K :: SZ :: [] } | Y { Y :: [] } | Z { Z :: [] } ending: | X_ { S::EOL::[]} | IENT_ { I::T::EOL::[]} | ENT_ { E::T::EOL::[]} | ERF_ { E_AGRAVE::R::EOL::[]} | EL_ { E_AGRAVE::L::EOL::[]} | EOL { EOL::[] } main: | append(flatten(letters*), ending) { $1 }