Are C or C++ regular languages? If not, under which category do we place the programming languages like C/C++, perl, Python?
Tell me more
×
Programmers Stack Exchange is a question and answer site for
professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.
|
|
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). |
|||||||||||||||
|