Assignment 3 syntax tree, phrases, phrases directly Handles

1. Known grammar:

S->a|^|(T)

T->T,S|S

Analysis sentence ( T, (^, A)), all required phrase, and the phrase directly handle.

 

S->(T)->(T,S)->(T,(T))->(T,(T,S))->(T,(S,S))->(T,(^,S))->(T,(^,a))

 

Direct phrases: ^   A

Handle: ^

短语:^  a  ^,a  (^,a)  T,(^,a)  (T,(^,a))

 

 

2. The context-free grammar structure description language:

1anbn|n>=0}

2ambn|m>=n>=0}

( 3 ) IF statement

 

(1)G[S]:S->aSb|ab|ε 

(2)G[S]:S->aSb|ab|a|ε

(. 3) G [S]: -S-> IF ( condition ) {( executing statements )} S | if ( condition ) {( the statement is executed ) the else {} ( executing statements )}

Guess you like

Origin www.cnblogs.com/seele233/p/11545344.html