^ 在 "let's build a compiler" 代码中的含义

^ meaning in "let's build a compiler" code

在 Jack Crenshaw 的 "Lets' build a compiler" 中,^I 是什么意思:

 const TAB = ^I;

他还在他的一个函数中使用 ^G。

它是 Control-I。这转换为 ASCII char-9,这是 Tab 的字符。类似地,Ctrl-G 是 ASCII char-7,它是 BEL(字面意思是铃)的字符,通常会从控制台发出哔哔声。

来自Free Pascal Language Reference

Also, the caret character ( ^ ) can be used in combination with a letter to specify a character with ASCII value less than 27. Thus ^G equals #7 - G is the seventh letter in the alphabet. The compiler is rather sloppy about the characters it allows after the caret, but in general one should assume only letters.

结果是一个单字节的 ASCII 字符常量。 I 是字母表中的第 9 个字母。毫无疑问,ASCII 值 9 是 TAB 字符。