Skip to content
This repository
Newer
Older
100644 79 lines (59 sloc) 2.284 kb
fccc6851 » MLstate
2011-06-21 Initial open-source release
1 (*
2 Copyright © 2011 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18
19 (**
20 Abstraction on backend languages : "ml" / "c" / "js"
21
22 @author Mathieu Barbin
23 @author Mehdi Bouaziz
24 *)
25
26 (** The extension corresponding to the language *)
27 type ext = string
28
29 (** The abstract type of a back-end language *)
30 type t
31 type format = [ `compiled | `interpreted ]
32 val compare : t -> t -> int
33
34 (** building a value of type [Language.t]. If the string is not recognized, the function returns [None] *)
35 val of_string : ?format:format -> string -> t option
36 val to_string : t -> string
37 val pp : t LangPrint.pprinter
38 val pp_list : t list LangPrint.pprinter
39
40 (** if you don't want to do a map + verification of unicity *)
41 val of_list : string list -> t list option
42
43 (** Get a list of language from a string. use the syntax : ["{ml, js, c}"] *)
44 val parse : string -> t list option
45
46 (** Get a printable representation of a list of languages. e.g. "[{ml, js, c}]" *)
47 val print : t list -> string
48
49 (** Force the format of a language.*)
50 val formate : format -> t -> t
51
52 (** {6 Compiled}*)
53
54 val ml : t (** Traditional ocaml code *)
55 val js : t (** JavaScript code, for use on the client (technically interpreted, but not by us) *)
56 val c : t (** C code, for use with e.g. LLVM *)
57
58 (** {6 Sugar} *)
59
60 val is_ml : t -> bool
61 val is_js : t -> bool
62 val is_c : t -> bool
63
64 (**{6 Interpreted}*)
65
66 val mli : t (** Traditional ocaml code, to be used in an interpreter (opatop) *)
67
68 (** {6 Code generation} *)
69 (**
70 In the generated plugins and loaders, there are reference to languages.
71 {[
72 L.ml, L.mli, L.js, etc...
73 ]}
74 The generated code should contains
75 {[
76 module L = BslLanguag
77 ]}
78 *)
79 val pp_meta : t LangPrint.pprinter
Something went wrong with that request. Please try again.