forked from ccccourse/sp110b
-
Notifications
You must be signed in to change notification settings - Fork 0
week3
wukunru edited this page Jun 14, 2022
·
4 revisions
詞彙理論:Regular Expression(RE)
語句層次:Context-Free Grammar(CFG)
語法:
英文語法:
BNF
<expr> ::= <expr> + <term>
| <expr> - <term>
| <term>
<term> ::= <term> * <factor>
| <term> / <factor>
| <factor>
EBNF
<expr> ::= <term> {(+|-)<term>}
<term> ::= <factor> {(*|/) <factor>}
BNF
<signed int> ::= + <int> | - <int>
<int> ::= <digit> | <int> <digit>
EBNF
<signed int> ::= [+|-] <digit> {<digit>}*