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) −
- an expression-statement
- a do/while iteration-statement
- the various jump-statements
- the simple-declaration
These are all part of the C++ grammar. You can read more about these statements in the ISO C++ specification.