summaryrefslogtreecommitdiff
path: root/src/lib/prononciation.mly
blob: 6fe0d5f127c35da67418cf2f0d4a7ae2046df49b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
%{

    (** 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
%}

%start<Tokens.token list> main
%%

voyel:
  | A           { A }
  | E           { E }
  | I           { I }
  | O           { O }
  | A U         { O }
  | E A U       { O }
  | O U         { OU }
  | U           { U }
  | E_ACUTE     { E_ACUTE }
  | E_AGRAVE    { E_AGRAVE }


letters:
  |                 { [] }
  | letters voyel  { $2 :: $1 }
  | letters Space   { Space :: $1 }
  | letters Sep     { Sep :: $1 }

  | letters B       { B :: $1 }
  | letters C       { K :: $1 }
  | letters C H     { X :: $1 }
  | letters C I     { I :: S :: $1 }
  | letters C E     { E :: S :: $1 }
  | letters C U I   { I :: K :: $1 }
  | letters C U E   { E :: K :: $1 }
  | letters D       { D :: $1 }
  | letters D D     { D :: $1 }
  | letters F       { F :: $1 }
  | letters G       { G :: $1 }
  | letters G I     { I :: J :: $1 }
  | letters G E     { E :: J :: $1 }
  | letters G U I   { I :: G :: $1 }
  | letters G U E   { E :: G :: $1 }
  | letters H       { Sep :: $1 }

  | letters J       { J :: $1 }
  | letters K       { K :: $1 }
  | letters E L L   { L :: E_AGRAVE :: $1 }
  | letters E L     { L :: E :: $1 }
  | letters I L L   { Y :: I :: $1 }
  | letters I L     { L :: I :: $1 }
  | letters L       { L :: $1 }
  | letters M       { M :: $1 }
  | letters M M     { M :: $1 }
  | letters N       { N :: $1 }
  | letters N N     { N :: $1 }

  | letters O I N   { N :: I :: W :: $1 }
  | letters O I     { A :: W :: $1 }

  | letters P       { P :: $1 }
  | letters P H     { F :: $1 }

  | letters Q U     { K :: $1 }

  | letters R       { R :: $1 }
  | letters S S     { S :: $1 }
  | letters S H     { X :: $1 }
  | letters S       { SZ :: $1 }
  | letters T       { T :: $1 }

  | letters V       { V :: $1 }
  | letters W       { W :: $1 }
  | letters X       { S :: K :: $1 }
  | letters Y       { Y :: $1 }

  | letters Z       { Z :: $1 }

main: 
  | letters EOL     { EOL::$1 }