Current location - Recipe Complete Network - Complete recipe book - What is the particularity of lexical analysis in C language?
What is the particularity of lexical analysis in C language?
As the name implies, the lexical analyzer examines morphology, while the parser analyzes grammar, what is morphology and what is grammar.

The so-called morphology, the source code consists of a character stream, which includes keywords, variable names, method names, brackets and other symbols, in which variable names must meet the conditions that they cannot include punctuation marks, numbers and letters starting with numbers, and brackets must appear in pairs, etc., which is morphology;

Grammar and morphology can only be analyzed if there is no problem. Grammar is the method of word arrangement, literally, such as a Chinese sentence: I eat radish, and there are three words I eat radish. In addition to "I eat radish", these three words can also be composed of "radish eats me" and "radish eats me". Obviously, according to Chinese grammar, the last two sentences are wrong, and the grammar analyzer analyzes grammar like this.