Parsing premise
To describe the grammatical structure of the language
Using regular type and finite automaton description language recognition and word symbols
- With context-free grammar to describe the syntax rules
The task of parsing
Analysis of the structure of a sentence of grammar
Parser functions
Production according to grammar ( grammar rules of the language ) , to identify whether or not the input symbol string as a sentence ( fit program )
Parser position in the compiler
Method for parsing
Bottom-up (Bottom-up)
- Starting from the input string , gradual reduction until the start symbol of the grammar
- Reduction : The production rule grammar , the string appears in the replacement of the production into a left portion and right portion of the symbol
- From the tree leaf nodes start, constructed syntax tree
- Operator precedence analysis, LR analysis
Top-down (Top-down)
- From the start symbol of the grammar, repeated use of a variety of productions, to find a "match" derivation
- Derivation: The production rule grammar , the string appears in the replacement symbol generation left portion to the right portion of formula
- From the tree roots began to construct the syntax tree
- Recursive descent analysis , predictive analysis program