Octal character \0ddd escape code for the ASCII ESC character

I’m from a C background so forgive me if this is a stupid question.

I was reading Mutability and Imperative Control Flow · OCaml Documentation

which has the following example:

try
print_endline "Press Escape to exit";
while true do
  let c = get_char () in
  if c = '\027' then raise Exit;
  print_char c;
  flush stdout
done
with Exit -> ();; 

And the explanation says “When the ASCII Escape character is read, the Exit exception is thrown”. Why is the ASCII Escape character ‘\027’, and not ‘\033’ which I would expect for an octal escape sequence in C (and other languages)? Is this a typo, because ASCII Escape is decimal 27, octal 33, hex 1B?

According to the manual, \027 is decimal: OCaml - The OCaml language. For octal, it’d have to be \o033 I think.

Thank you. The \o prefix for octal escapes looks like a great design decision. The lead zero implying the base 8 in escapes and int literals is a source of bugs in C (except in the case of a single ‘0’ for zero). It’s also nice the number of digits in the escape is exactly 3 (or exactly 2 in the case of hex). The choice of allowing decimal escapes without a prefix is a bit of a trap for people coming from C (if only the designers had used something like ‘d’ as a prefix consistent with the other notations of ‘o’ or ‘x’, and made \ followed by a digit lexically illegal).