Context Free Grammar for the language of C++ identifiers consisting of uppercase and lowercase letters, digits, and the underscore character ‘_’, and starting with a letter or underscore
C++ is not a context-free language. It is context-sensitive.C++ has syntax and semantics.The syntax is a set of rules or grammar .and semantics refers to the meaning.
C++ has a set of naming conventions
1. It should not begin with a digit or an underscore: int 4d; is invalid
2. Uppercase and Lower case is different: int a; and int A; are both considered as different in C++.
3. Special characters are not allowed: int c#a; this kind of naming is not allowed
4.keywords are not allowed: int struct; such kind is invalid because struct is a keyword used for the structure.
5. White spaces are not allowed: int new Delhi; is invalid.
Get Answers For Free
Most questions answered within 1 hours.