From 28871579687690d83b69203fa160e213a3e40003 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Mon, 24 Apr 2023 17:17:55 +0200 Subject: Update --- src/lib/repr/ipa.ml | 74 ++++++++++++++++++++++++++++++++++++++ src/lib/repr/rousseau.mli | 74 ++++++++++++++++++++++++++++++++++++++ src/lib/repr/tengwar.ml | 91 +++++++++++++++++++++++++++++++++++++++++++++++ src/lib/repr/tengwar.mli | 73 +++++++++++++++++++++++++++++++++++++ 4 files changed, 312 insertions(+) create mode 100644 src/lib/repr/ipa.ml create mode 100644 src/lib/repr/rousseau.mli create mode 100644 src/lib/repr/tengwar.ml create mode 100644 src/lib/repr/tengwar.mli diff --git a/src/lib/repr/ipa.ml b/src/lib/repr/ipa.ml new file mode 100644 index 0000000..b41d7b9 --- /dev/null +++ b/src/lib/repr/ipa.ml @@ -0,0 +1,74 @@ +open StdLabels + +type t = string + +let none = "" + +let space s = s + +let a = "a" +and a_nasal = "ɑ̃" + +and e_opened = "ɛ" +and e_closed = "e" +and schwa = "ə" + +and eu_opened = "œ" +and eu_closed = "ø" + +and o = "o" +and o_nasal = "ɔ̃" + +and i = "i" +and i_nasal = "ɛ̃" +and y = "y" +and y_nasal = "œ̃" + +and u = "y" + +and p = "p" +and b = "b" +and t = "t" +and d = "d" + +and k = "k" +and g = "g" + +and f = "f" +and v = "v" + +and ch = "ʃ" +and j = "ʒ" + +and s = "s" +and z = "z" + +and m = "m" +and n = "n" + +and gn = "ɲ" + +and l = "l" +and r = "ʁ" + +and semi_voyel_w = "w" +and semi_voyel_y = "j" +and semi_voyel_u = "ɥ" + +let muted + : t -> t + = fun t -> + Printf.sprintf "(%s)" t + +let diphtongue + : t -> t -> t + = fun t1 t2 -> + Printf.sprintf "[%s%s]" t1 t2 + +let fold + : t list -> string + = fun elems -> + let buff = Buffer.create 16 in + List.iter elems + ~f:(fun f -> Buffer.add_string buff f); + Buffer.contents buff diff --git a/src/lib/repr/rousseau.mli b/src/lib/repr/rousseau.mli new file mode 100644 index 0000000..6ff79d9 --- /dev/null +++ b/src/lib/repr/rousseau.mli @@ -0,0 +1,74 @@ +type position_type = + [ `Above + | `Below ] + +(** Consonant category *) +type category + +type 'a voyel = + { position : position_type + ; app : ('a -> string) } + +type 'a consonant = + { position : 'a + ; muted: string option + ; repr : string + ; primary : bool + ; category : category } + +type 'a glyph = + { tengwa : 'a consonant option + (* The eventual Tehta above the tengwa *) + ; tehta_above : 'a voyel option + (* And below *) + ; tehta_below : 'a voyel option + } + + +val empty_glyph : 'a glyph +val portant: string -> 'a -> 'a consonant + +type 'a t = + | Consonant: 'a consonant -> 'a t + | Voyel: 'a voyel -> 'a t + | Application: ('a t -> 'a t list) -> 'a t + | Repr of string + | Glyph: 'a glyph -> 'a t + | Nothing + +val voyel + : position_type -> ('a -> string) -> 'a t + +val none : 'a t +val space : string -> 'a t + +val nasal + : 'a t -> 'a t -> 'a t -> ' a voyel -> 'a t + +val diphtongue + : 'a t -> 'a t -> 'a t + +val fold + : portant:'a consonant -> 'a t list -> string + +val p: string -> string option -> 'a -> 'a t +val b: string -> string option -> 'a -> 'a t +val t: string -> string option -> 'a -> 'a t +val d: string -> string option -> 'a -> 'a t +val k: string -> string option -> 'a -> 'a t +val g: string -> string option -> 'a -> 'a t +val f: string -> 'a -> 'a t +val v: string -> 'a -> 'a t +val ch: string -> 'a -> 'a t +val j: string -> 'a -> 'a t +val s: string -> string option -> 'a -> 'a t +val z: string -> 'a -> 'a t +val m: string -> 'a -> 'a t +val n: string -> 'a -> 'a t +val gn: string -> 'a -> 'a t +val ng: string -> 'a -> 'a t +val r: string -> string option -> 'a -> 'a t +val l: string -> 'a -> 'a t +val semi_voyel_u: string -> 'a -> 'a t +val semi_voyel_y: string -> 'a -> 'a t +val semi_voyel_w: string -> 'a -> 'a t diff --git a/src/lib/repr/tengwar.ml b/src/lib/repr/tengwar.ml new file mode 100644 index 0000000..85be6cc --- /dev/null +++ b/src/lib/repr/tengwar.ml @@ -0,0 +1,91 @@ +type tengwa = + | Tinco + | Parma + | Calma + | Quesse + + | Ando + | Umbar + | Anga + | Ungwe + + | Sule + | Formen + | Harma + | Hwesta + + | Anto + | Ampa + | Anca + | Unque + + | Numen + | Malta + | Noldo + | Nwame + + | Ore + | Vala + | Anna + | Vilya + + | Romen + | Arda + | Lambe + | Alda + + | Silme + | Silme_nuquerna + | Esse + | Esse_nuquerna + + | Hyarmen + | Hwesta_sindarinwa + | Yanta + | Ure + + | Halla + | Osse + | Telco + | Ara + +type tehta = + | Three_dots + | Two_dots + | Dot + | Acute + | Agrave + | Double_Acute + | Right_curl + | Left_curl + | Double_Right_curl + | Double_Left_curl + | Bar + + +let three_dots = Three_dots +let two_dots = Two_dots +let dot = Dot +let acute = Acute +let agrave = Agrave +let right_curl = Right_curl +let left_curl = Left_curl +let double_right_curl = Double_Right_curl +let double_left_curl = Double_Left_curl +let double_acute = Double_Acute +let bar = Bar + +type t = + { tengwa : tengwa + ; tehta_above : tehta option + ; tehta_below : tehta option + } + +let build + : tengwa -> tehta option -> tehta option -> t + = fun tengwa a b -> + + { tengwa + ; tehta_below = b + ; tehta_above = a } + diff --git a/src/lib/repr/tengwar.mli b/src/lib/repr/tengwar.mli new file mode 100644 index 0000000..e80279a --- /dev/null +++ b/src/lib/repr/tengwar.mli @@ -0,0 +1,73 @@ +type tehta + +val three_dots : tehta +val two_dots : tehta +val dot : tehta +val acute : tehta +val agrave : tehta +val right_curl : tehta +val left_curl : tehta +val double_right_curl: tehta +val double_left_curl: tehta +val double_acute: tehta +val bar: tehta + +type tengwa = + | Tinco + | Parma + | Calma + | Quesse + + | Ando + | Umbar + | Anga + | Ungwe + + | Sule + | Formen + | Harma + | Hwesta + + | Anto + | Ampa + | Anca + | Unque + + | Numen + | Malta + | Noldo + | Nwame + + | Ore + | Vala + | Anna + | Vilya + + | Romen + | Arda + | Lambe + | Alda + + | Silme + | Silme_nuquerna + | Esse + | Esse_nuquerna + + | Hyarmen + | Hwesta_sindarinwa + | Yanta + | Ure + + | Halla + | Osse + | Telco + | Ara + +type t = + { tengwa : tengwa + ; tehta_above : tehta option + ; tehta_below : tehta option + } + +val build + : tengwa -> tehta option -> tehta option -> t -- cgit v1.2.3