STUDY/C++
C/C++ 토큰(token) 과 구두점
Trip the light
2021. 11. 10. 04:08
1. 토큰
- C 프로그램을 구성하는 기본 단위
- 예약어(reserved word, keyword) : int, if
- 연산자(operator)
- 구두점(punctuator) : [], ()
- 식별자(identifier) : 변수, 함수, 배열, 구조체
- 상수(constant) 또는 literal : 100, 1.5
- 문자열(string) : "안녕하세요"
2. 구두점
- 토큰을 구분하기 위해 사용하는 기호
- [], (), {}, *, 콤마(,), ;, =, =, :, ..., ""
- =, (), [], 콤마 등은 같은 모양의 연산자도 있음
- 소스의 어느 부분에서 사용하느냐에 따라서 연산자인지 구두점인지 구별
auto break case char const continue default do dobule else enum extern |
float for goto if inline(since C99) int long register restrict(since C99) return short |
signed sizeof static struct switch typeof union unsigned void volatile while |
_Alignas(since C11) _Alignof(since C11) _Atomic(since C11) _Bool(since C99) _Complex(since C99) _Generic(since C11) _Imaginary(since C99) _Noreturn(since C11) _Static_assert(since C11) _Thread_local(since C11) |