# 請解釋下列名詞： (1) 關鍵字 (key word) (2) 保留字 (reserved word) (3) 懸置指標 (dangling pointer)

• Published on
30-Jan-2016

• View
34

6

Embed Size (px)

DESCRIPTION

SaBc BbXb BbX Xa Xab (a) ababc (b) ambiguous (c) . - PowerPoint PPT Presentation

Transcript

• SaBcBbXbBbXXaXab(a)ababc(b)ambiguous(c)

• A pretty book had a happy Mary ::= ::= ::= ::= JohnMary ::= bookpeanutfriend ::= happyprettytasty ::= athe ::= atelovedhad

• (1)(key word)(2)(reserved word)(3)(dangling pointer)(4)(dangling label reference)

• (BNF)(expression)(parsing tree)(syntax error) : ::= ::=* ::= ::=TF ::=01 ::=IJKLMN (1)K1*I0+T*L1+M0*F+M1 (2)L1*(J0+M1)+I1

• EBNF (Extended Backus-Naur Form) :: = [] [] :: = 111 :: = 0 | 1 | 0 | 1 (1)0000111111010(2)1111110(3)0011000101011(4)0110111011111

• EBNF(Extended Backus-Naur Form)::= A{B|C} [D](1)123(sentence)(2)EBNFBNF

• (syntax tree)(ambiguous grammar) ::=+ ::=* ::=id

• (parse tree) > ab > bb > aa()bbbaab()aaabba

• (BNF)(expression)(parsing tree)(syntax error) ::= * | ::= ^ | ::= A | B | C | D(a)A ^ B ^ C ^ D(b)A * B * C * D(c)A ^ B * C ^ D(d)A * B ^ C * D(e)A + B * C + D

• 9-(24/3+1*2)-2::= | * | / ::= | + | - ::=() | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10|. ..

• ()Grammar(essential components) ()(syntax)