src/HOL/Library/Code_Char.thy
author haftmann
Tue, 23 Jun 2009 14:24:58 +0200
changeset 31776 151c3f5f28f9
parent 31053 b7e1c065b6e4
child 32657 5f13912245ff
permissions -rw-r--r--
simplified proof
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24999
haftmann
parents:
diff changeset
     1
(*  Title:      HOL/Library/Code_Char.thy
haftmann
parents:
diff changeset
     2
    Author:     Florian Haftmann
haftmann
parents:
diff changeset
     3
*)
haftmann
parents:
diff changeset
     4
haftmann
parents:
diff changeset
     5
header {* Code generation of pretty characters (and strings) *}
haftmann
parents:
diff changeset
     6
haftmann
parents:
diff changeset
     7
theory Code_Char
30663
0b6aff7451b2 Main is (Complex_Main) base entry point in library theories
haftmann
parents: 30007
diff changeset
     8
imports List Code_Eval Main
24999
haftmann
parents:
diff changeset
     9
begin
haftmann
parents:
diff changeset
    10
haftmann
parents:
diff changeset
    11
code_type char
haftmann
parents:
diff changeset
    12
  (SML "char")
haftmann
parents:
diff changeset
    13
  (OCaml "char")
haftmann
parents:
diff changeset
    14
  (Haskell "Char")
haftmann
parents:
diff changeset
    15
haftmann
parents:
diff changeset
    16
setup {*
31053
b7e1c065b6e4 confine term setup to Eval serialiser
haftmann
parents: 31046
diff changeset
    17
  fold String_Code.add_literal_char ["SML", "OCaml", "Haskell"] 
b7e1c065b6e4 confine term setup to Eval serialiser
haftmann
parents: 31046
diff changeset
    18
  #> String_Code.add_literal_list_string "Haskell"
24999
haftmann
parents:
diff changeset
    19
*}
haftmann
parents:
diff changeset
    20
haftmann
parents:
diff changeset
    21
code_instance char :: eq
haftmann
parents:
diff changeset
    22
  (Haskell -)
haftmann
parents:
diff changeset
    23
haftmann
parents:
diff changeset
    24
code_reserved SML
haftmann
parents:
diff changeset
    25
  char
haftmann
parents:
diff changeset
    26
haftmann
parents:
diff changeset
    27
code_reserved OCaml
haftmann
parents:
diff changeset
    28
  char
haftmann
parents:
diff changeset
    29
28346
b8390cd56b8f discontinued special treatment of op = vs. eq_class.eq
haftmann
parents: 28244
diff changeset
    30
code_const "eq_class.eq \<Colon> char \<Rightarrow> char \<Rightarrow> bool"
24999
haftmann
parents:
diff changeset
    31
  (SML "!((_ : char) = _)")
haftmann
parents:
diff changeset
    32
  (OCaml "!((_ : char) = _)")
haftmann
parents:
diff changeset
    33
  (Haskell infixl 4 "==")
haftmann
parents:
diff changeset
    34
28228
7ebe8dc06cbb evaluation using code generator
haftmann
parents: 28090
diff changeset
    35
code_const "Code_Eval.term_of \<Colon> char \<Rightarrow> term"
31046
c1969f609bf7 confine term setup to Eval serialiser
haftmann
parents: 30663
diff changeset
    36
  (Eval "HOLogic.mk'_char/ (IntInf.fromInt/ (Char.ord/ _))")
28228
7ebe8dc06cbb evaluation using code generator
haftmann
parents: 28090
diff changeset
    37
24999
haftmann
parents:
diff changeset
    38
end