Compilation principle note 7 top-down syntax analysis-...

Source: Internet
Author: User

1. Introduction

1) The status of grammatical analysis: is the core part of the compiler program.

2) The task of parsing: to identify whether the word sequence obtained by lexical analysis is a sentence of a given grammar.

3) Theoretical basis of grammatical analysis: context-independent grammar and push-down automata.

4) Syntax Analysis: (1) Top-down syntax analysis: Repeated use of different production to deduce to seek to match the input symbol string. (2) Bottom-up syntax analysis: the input symbol string looking for different production to the statute until the beginning of the grammar symbol. Note: The input symbol described here refers to the word that is recognized by lexical analysis.

2. Push-down automata:

1) Push-down automata model

2) The form definition of the push-down automata: note: A. The PDA defined by this is definitely an indeterminate PDA. This will bring uncertainty to the parsing of the grammar. When we construct the PDA m algorithm, we need to make some restrictions on the PDA. B.PDA uses "| |" to indicate that the PDA has done one step. C. The input string can be accepted by the PDA, only if the input string is read, the lower push stack is empty, or the input string is read, the controller reaches some final state. D. Sometimes, the push-down automata also configures the output bands to record all the generation numbers of the derivation or statute process. E. For a form like a->ω, there is § (Q, empty string, A) = (q,ω), which is called derivation.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.