src/Tools/Code/code_target.ML
changeset 82389 ec39ec5447e6
parent 82380 ceb4f33d3073
equal deleted inserted replaced
82388:f1ff9123c62a 82389:ec39ec5447e6
     6 
     6 
     7 signature CODE_TARGET =
     7 signature CODE_TARGET =
     8 sig
     8 sig
     9   val cert_tyco: Proof.context -> string -> string
     9   val cert_tyco: Proof.context -> string -> string
    10   val read_tyco: Proof.context -> string -> string
    10   val read_tyco: Proof.context -> string -> string
    11 
       
    12   datatype pretty_modules = Singleton of string * Pretty.T | Hierarchy of (string list * Pretty.T) list;
       
    13   val next_export: theory -> string * theory
       
    14 
    11 
    15   val export_code_for: ({physical: bool} * (Path.T * Position.T)) option -> string -> string
    12   val export_code_for: ({physical: bool} * (Path.T * Position.T)) option -> string -> string
    16     -> int option -> Token.T list  -> Code_Thingol.program -> bool -> Code_Symbol.T list
    13     -> int option -> Token.T list  -> Code_Thingol.program -> bool -> Code_Symbol.T list
    17     -> local_theory -> local_theory
    14     -> local_theory -> local_theory
    18   val produce_code_for: Proof.context -> string -> string -> int option -> Token.T list
    15   val produce_code_for: Proof.context -> string -> string -> int option -> Token.T list
    45     -> (string list * Bytes.T) list * string
    42     -> (string list * Bytes.T) list * string
    46   val compilation_text': Proof.context -> string -> string option -> Code_Thingol.program
    43   val compilation_text': Proof.context -> string -> string option -> Code_Thingol.program
    47     -> Code_Symbol.T list -> bool -> ((string * class list) list * Code_Thingol.itype) * Code_Thingol.iterm
    44     -> Code_Symbol.T list -> bool -> ((string * class list) list * Code_Thingol.itype) * Code_Thingol.iterm
    48     -> ((string list * Bytes.T) list * string) * (Code_Symbol.T -> string option)
    45     -> ((string list * Bytes.T) list * string) * (Code_Symbol.T -> string option)
    49 
    46 
       
    47   datatype pretty_modules = Singleton of string * Pretty.T | Hierarchy of (string list * Pretty.T) list;
    50   type serializer
    48   type serializer
    51   type literals = Code_Printer.literals
       
    52   type language
    49   type language
    53   type ancestry
    50   type ancestry
    54   val assert_target: theory -> string -> string
    51   val assert_target: theory -> string -> string
    55   val add_language: string * language -> theory -> theory
    52   val add_language: string * language -> theory -> theory
    56   val add_derived_target: string * ancestry -> theory -> theory
    53   val add_derived_target: string * ancestry -> theory -> theory
    57   val the_literals: Proof.context -> string -> literals
    54   val the_literals: Proof.context -> string -> Code_Printer.literals
       
    55 
    58   val parse_args: 'a parser -> Token.T list -> 'a
    56   val parse_args: 'a parser -> Token.T list -> 'a
    59   val default_code_width: int Config.T
    57   val default_code_width: int Config.T
       
    58   val next_export: theory -> string * theory
    60 
    59 
    61   type ('a, 'b, 'c, 'd, 'e, 'f) symbol_attr_decl
    60   type ('a, 'b, 'c, 'd, 'e, 'f) symbol_attr_decl
    62   val set_identifiers: (string, string, string, string, string, string) symbol_attr_decl
    61   val set_identifiers: (string, string, string, string, string, string) symbol_attr_decl
    63     -> theory -> theory
    62     -> theory -> theory
    64   val set_printings: (Code_Printer.raw_const_syntax, Code_Printer.tyco_syntax, string, unit, unit, string * Code_Symbol.T list) symbol_attr_decl
    63   val set_printings: (Code_Printer.raw_const_syntax, Code_Printer.tyco_syntax, string, unit, unit, string * Code_Symbol.T list) symbol_attr_decl
    70 struct
    69 struct
    71 
    70 
    72 open Basic_Code_Symbol;
    71 open Basic_Code_Symbol;
    73 open Basic_Code_Thingol;
    72 open Basic_Code_Thingol;
    74 
    73 
    75 type literals = Code_Printer.literals;
       
    76 type ('a, 'b, 'c, 'd, 'e, 'f) symbol_attr_decl =
    74 type ('a, 'b, 'c, 'd, 'e, 'f) symbol_attr_decl =
    77   (string * (string * 'a option) list, string * (string * 'b option) list,
    75   (string * (string * 'a option) list, string * (string * 'b option) list,
    78     class * (string * 'c option) list, (class * class) * (string * 'd option) list,
    76     class * (string * 'c option) list, (class * class) * (string * 'd option) list,
    79     (class * string) * (string * 'e option) list,
    77     (class * string) * (string * 'e option) list,
    80     string * (string * 'f option) list) Code_Symbol.attr;
    78     string * (string * 'f option) list) Code_Symbol.attr;
   170     module_name: string }
   168     module_name: string }
   171   -> Code_Thingol.program
   169   -> Code_Thingol.program
   172   -> Code_Symbol.T list
   170   -> Code_Symbol.T list
   173   -> pretty_modules * (Code_Symbol.T -> string option);
   171   -> pretty_modules * (Code_Symbol.T -> string option);
   174 
   172 
   175 type language = {serializer: serializer, literals: literals,
   173 type language = {serializer: serializer, literals: Code_Printer.literals,
   176   check: {env_var: string, make_destination: Path.T -> Path.T, make_command: string -> string},
   174   check: {env_var: string, make_destination: Path.T -> Path.T, make_command: string -> string},
   177   evaluation_args: Token.T list};
   175   evaluation_args: Token.T list};
   178 
   176 
   179 type ancestry = (string * (Code_Thingol.program -> Code_Thingol.program)) list;
   177 type ancestry = (string * (Code_Thingol.program -> Code_Thingol.program)) list;
   180 
   178