跳转到内容

Compiler 2013: Tokens

来自ACM Class Wiki

Comments

 // single-line comment
 /* multi-line comment */

Multi-line comments are NOT nested, so /* x /* y */ z */ SHOULD be treated as z */.

Constants

 identifier
 12345678
 01234567
 0xABCDEF
 'c'
 "string"

An identifier is a letter followed by zero or more letters and/or digits. _ and $ are considered as letters.

Keywords

 typedef
 void
 char
 int
 struct
 union
 if
 else
 while
 for
 continue
 break
 return
 sizeof

Keywords defined in ANSI C but not defined here SHOULD be ignored, e.g. static, const, ...

Single-character operators

 (
 )
 ;
 ,
 =
 {
 }
 [
 ]
 *
 |
 ^
 &
 <
 >
 +
 -
 *
 /
 %
 ~
 !
 .

Multi-character operators

 OR   ||
 AND  &&
 EQ   ==
 NE   !=
 LE   <=
 GE   >=
 SHL  <<
 SHR  >>
 INC  ++
 DEC  --
 PTR  ->
 ELLIPSIS ...
 MUL_ASSIGN  *=
 DIV_ASSIGN  /=
 MOD_ASSIGN  %=
 ADD_ASSIGN  +=
 SUB_ASSIGN  -=
 SHL_ASSIGN  <<=
 SHR_ASSIGN  >>=
 AND_ASSIGN  &=
 XOR_ASSIGN  ^=
 OR_ASSIGN   |=