-
Notifications
You must be signed in to change notification settings - Fork 0
/
produce.txt
25 lines (25 loc) · 925 Bytes
/
produce.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
S' -> <pro>
<pro> -> <announceList>|<pro> <fun>
<announceList> -> <announce>|<announceList> <announce>
<announce> -> import < <identifier> > ;
<fun> -> <keyword> <identifier> <param> <block>
<keyword> -> void|int|char|float|double|def
<identifier> -> id
<param> -> ( <type> <identifier> )
<type> -> int|float|double|char|var
<block> -> { <statementList> }|{ }
<block> -> { <announceState> <statementList> }|{ }
<announceState> -> <type> <identifier> ;|<type> <EQUAL>
<statementList> -> <statement>|<statementList> <statement>
<statement> -> <IF>|<EQUAL>|<WHILE>
<IF> -> <S1>|<S2>
<S1> -> if <b> { <statementList> } else { <statementList> }
<S2> -> if <b> { <statementList> }
<EQUAL> -> id = <exp> ;
<WHILE> -> while <b> do { <statementList> } ;
<b> -> ( <LOGICexp> )
<exp> -> <exp> + T|T|<exp> - T
T -> F * F|F / F|F
F -> <identifier>|( <exp> )
<LOGICexp> -> <identifier> <LOGICop> <identifier>
<LOGICop> -> >=|<=|<|!|==|!=|>