src/HOL/Library/Code_Char.thy
author haftmann
Wed May 06 19:09:14 2009 +0200 (2009-05-06)
changeset 31053 b7e1c065b6e4
parent 31046 c1969f609bf7
child 32657 5f13912245ff
permissions -rw-r--r--
confine term setup to Eval serialiser
     1 (*  Title:      HOL/Library/Code_Char.thy
     2     Author:     Florian Haftmann
     3 *)
     4 
     5 header {* Code generation of pretty characters (and strings) *}
     6 
     7 theory Code_Char
     8 imports List Code_Eval Main
     9 begin
    10 
    11 code_type char
    12   (SML "char")
    13   (OCaml "char")
    14   (Haskell "Char")
    15 
    16 setup {*
    17   fold String_Code.add_literal_char ["SML", "OCaml", "Haskell"] 
    18   #> String_Code.add_literal_list_string "Haskell"
    19 *}
    20 
    21 code_instance char :: eq
    22   (Haskell -)
    23 
    24 code_reserved SML
    25   char
    26 
    27 code_reserved OCaml
    28   char
    29 
    30 code_const "eq_class.eq \<Colon> char \<Rightarrow> char \<Rightarrow> bool"
    31   (SML "!((_ : char) = _)")
    32   (OCaml "!((_ : char) = _)")
    33   (Haskell infixl 4 "==")
    34 
    35 code_const "Code_Eval.term_of \<Colon> char \<Rightarrow> term"
    36   (Eval "HOLogic.mk'_char/ (IntInf.fromInt/ (Char.ord/ _))")
    37 
    38 end