Are C or C++ regular languages? If not, under which category do we place the programming languages like C/C++, perl, Python?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
The only universal definition I know of for "regular language" is one that can be parsed with a deterministic finite automaton, or expressed as a true regular expression (not the extended REs in many current implementations). A regular expression can be written in a series of characters, with potentially infinite repetitions and alternate selections.
Since both C and C++ allow nesting of braces, brackets, and parentheses to arbitrary depths, they aren't regular languages (check out the Pumping Lemma for details).