1. understood that symbol string and set operations.
L={A,B, … ,Z,a,b, … ,z}
D={0,1, … ,9}
Description meaning under represented:
LUD : a collection of all uppercase and lowercase letters and numbers
The LD : a collection of all of a symbol string of letters and numbers of a
L4 : a set of strings of symbols of the four-letter
* L : the set of all ξ symbol string of the alphabet
+ D : all symbols of one or several strings of digits
L (an LUD) * : beginning with the letter, followed by a set of all strings all symbols consisting of letters and numbers
2. grammar G (Z): Z-> aZb | ab definition of what kind of language?
Generating the formula: Z-> AZB, Z-> ab &
Derived: Z-> aZb-> aaZZbb-> aaaabbbb
So language is composed of several symbol sequence followed by a set of all composed of a number b, and a number equal to the number of b.
3. Write grammar quaternion form materials 22 pages identifiers in example 2.2 (V N , V T , P, S).
Set I is the identifier, L letter, D is a digital
VN {I,L,D},VT{a,b,c,...x,y,z,0,1,2,...9}
P={
I-> L | IL | ID
L->a|b|c|d|...|z
D->0|1|2|3|...|9
}
S= I
4. Write the following expressions leftmost derivation, rightmost derivation.
G (E):
E=> E + T | T
T=>T * F | F
F=>(E)| i
- i*i+i
- i+i*i
- i+(i+i)
Observe different leftmost and rightmost derivation process.
i*i+i:
最左推导:E=>E+T=>T+T=>T*F+T=>F*F+T=>i*F+T=>i*i+T=>i*i+F=i*i+i
最右推导:E=>E+T=>E+F=>E+i=>T+i=>T*F+i=>T*i+i=>F*i+i=>i*i+i
i+i*i:
最左推导:E=>E+T=>T+T=>F+T=>i+T=>i+T*F=>i+F*F=>i+i*F=i+i*i
最右推导:E=>E+T=>E+T*F=>E+T*i=>E+F*i=>E+i*i=>T+i*i=>F+i*i=>i+i*i
i+(i+i):
最左推导:E=>E+T=>T+T=>F+T=>i+T=>i+F=>i+(E)=>i+(E+T)=>i+(T+T)=>i+(F+T)=>i+(i+T)=>i+(i+F)=>i+(i+i)
最右推导:E=>E+T=>E+F=>E+(E)=>E+(E+T)=>E+(E+F)=>E+(E+i)=>E+(T+i)=>E+(F+i)=>E+(i+i)=>T+(i+i)=>F+(i+i)=>i+(i+i)