Infix "<?"  := ltb : char_scope.
Infix "<=?" := leb : char_scope.
(** * Concrete syntax *)
(** Ascii characters can be represented in scope char_scope as follows: - ["c"]   represents itself if c is a character of code < 128, - [""""]  is an exception: it represents the ascii character 34 (double quote), - ["nnn"] represents the ascii character of decimal code nnn.  For instance, both ["065"] and ["A"] denote the character `uppercase A', and both ["034"] and [""""] denote the character `double quote'.  Notice that the ascii characters of code >= 128 do not denote stand-alone utf8 characters so that only the notation "nnn" is available for them (unless your terminal is able to represent them, which is typically not the case in coqide). *)
Definition ascii_of_byte (b : byte) : ascii
:= let '(b0, (b1, (b2, (b3, (b4, (b5, (b6, b7))))))) := Byte.to_bits b in
Ascii b0 b1 b2 b3 b4 b5 b6 b7.
Definition byte_of_ascii (a : ascii) : byte
:= let (b0, b1, b2, b3, b4, b5, b6, b7) := a in
Byte.of_bits (b0, (b1, (b2, (b3, (b4, (b5, (b6, b7))))))).

Lemma byte_of_ascii_of_byte x : byte_of_ascii (ascii_of_byte x) = x.