summaryrefslogtreecommitdiff
path: root/src/lib/prononciation.mly
blob: 09124a6b82e5dd4a26e2362621a9b2bc2fd8f2b0 (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
87
88
89
90
91
%{

    (** 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:
  | voyel  { $1 :: [] }
  | Space   { Space :: [] }
  | Sep     { Sep :: [] }

  | B       { B :: [] }
  | C       { K :: [] }
  | C H     { X :: [] }
  | C I     { S :: I :: [] }
  | C E     { S :: E :: [] }
  | 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 :: E :: [] }
  | G U     { G :: U :: [] }
  | G U I   { G :: I :: [] }
  | G U E   { G :: E :: [] }
  | H       { Sep :: [] }

  | J       { J :: [] }
  | K       { K :: [] }
  | E L     { E :: 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 :: [] }
  | P H     { F :: [] }

  | Q       { K :: [] }
  | Q U     { K :: [] }

  | R       { R :: [] }
  | S       { SZ :: [] }
  | S S     { S :: [] }
  | S H     { X :: [] }
  | T       { T :: [] }

  | V       { V :: [] }
  | W       { W :: [] }
  | X       { K :: S :: [] }
  | Y       { Y :: [] }

  | Z       { Z :: [] }

ending: 
  | EOL %prec Low            { EOL::[] }

main: 
  | append(flatten(letters*), ending)     { $1 }