Fourth job: grammar and language summary and comb

1. carding second chapter, understand and write a summary.

 A: In this chapter learning content, I learned the knowledge points are as follows:

Intuitive concepts (1) grammar

  Chinese sentences can be made by the predicate, constitute predicate verb and direct object, using EBNF first chapter of learning to express rule consisting of:

  <Sentence> :: = <Subject> <predicate>

  <Subject> :: = <-generation language> | <noun>

  <Pronouns> :: = me | you | him

  <Noun> :: = Wang | Students | worker | English

  <Predicate> :: = <verb> <direct object>

  <Verb> :: = Yes | learning

  <Direct object> :: = <pronouns> | <noun>

  * These rules as a kind of meta-language, use it to describe Chinese, we will describe this language called grammar.

(2) symbols, and a symbol string

   . A Alphabet: The alphabet is a nonempty finite set of elements, e.g., Σ = {a, b, c}, referred to as a symbol alphabet elements, also referred to as symbol set; alphabet definition, [Sigma alphabet, which consists of a, b, c two elements. It comprises at least one element of an alphabet. Alphabet elements can be letters, numbers or other symbols.

   symbol string b: Any finite sequence of symbols from the alphabet is called a string, for example, 0011110 symbol string alphabet Σ = {0,1}.

            * If there is a symbol string of m symbols in x, is called its length m, represented as | x | = m, such as the length is 6 001110.

            * Allow the empty string of symbols, i.e., does not contain any symbol in the symbol string, denoted by [epsilon], a length of 0, i.e. | ε | = 0 ;.

     Operations:

            Ⅰ head and tail of the string: If z = xy symbol string is a string, then the head of z x, z y is the tail, if x is not empty, then y is a natural tail.

            Ⅱ connected strings of symbols: x and y are set symbol string thereof is connected to the symbol y xy written symbols in a symbol string obtained after x.

            Powers Ⅲ symbol string: Let x be a symbol string, the self-ligation x n times the symbol string to obtain Z, i.e., z = xx .... x, is called a power of the symbol string x.

            . IV symbol string set: The set of all elements are on a string of symbols in the alphabet A, then A is a set of strings of symbols in the alphabet changes.

                After the designated alphabet * [Sigma, [Sigma * represents the set of all available finite length strings on Σ. Σ * [Sigma called aggregate closure, and [Sigma +  =  [Sigma . 1 the U-[Sigma 2 . ... [Sigma n- called [Sigma positive closure.

                * Σ * has an infinite number of elements countable. Use of symbols representing the general set theory: If x is an element in Σ *, then expressed as x ∈ Σ *, or x ∉ Σ *. For all Σ, there is ε ∈ Σ *.

(3) define the form of the grammar and language

   a rule: referred to as rewrite rules, production or production type, is of the form α → ß or α :: = ß of (α, ß) ordered pair, where [alpha] is called the left part of the rule, referred ß the right part of the rule.

   . b quad (V N , V T , P, S): V N non-terminators (or grammatical entity, or a variable) set ; V T is the set of terminal symbols; P is a set of rules (α → ß) of , [alpha] ∈ (V N the U-V T ) * and comprising at least one non-terminal symbol, ß ∈ (V N  the U-V T ) *; V N , V T and P had plenty of non-finite set. S or an identifier called the start symbol, which is a non-terminal symbol.

        V * N and V T does not contain a common element, i.e., V N ∩ V T = Ø.

        Generally denoted by V * V N  the U-V T  , V alphabet called the vocabulary or grammar G in the table.

   . c DERIVATION: α → ß is provided grammar = G (V N , V T , P, S) (or say a production in P), gamma] and δ is any symbol in the V *, if the symbol string v, ω satisfied: v = γαδ, ω = γßδ ;

Says v direct result of ω, ω or say v is the direct derivation.

   d sentence, the sentence: Let G [S] is a grammar, if x is a symbol string from the

 

2. Try to write grammar PL / 0 language. (Or do you think the better language rules)

Integer n

I identifier

Expression e

Conditional statements

Assignment

Compound statement

function

program

...

Guess you like

Origin www.cnblogs.com/zxf001/p/11590419.html