According to the ISO C++ specifications, The lexical representation of C++ programs includes a number of preprocessing tokens which are used in the syntax of the preprocessor or are converted into tokens for operators and punctuators. The semicolon is a punctuator in C++.
A semicolon character is at the end of the following parts of a C++ grammar (not necessarily a complete list) −
These are all part of the C++ grammar. You can read more about these statements in the ISO C++ specification.