Compiler 2015: Tokens
外观
Identifiers
An identifier is a letter followed by zero or more letters and/or digits. _ and $ and a-zA-z are considered as letters.
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. However, a string cannot be pushed onto a second line. For example, when compiling the below program, you should report an error:
int main(){
"\n
";}
Keywords
typedefvoid 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, bool, etc. If you see these, just view it as normal variables. (You may assume that testcases will not cover these keywords.)
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 |=