[阅读: 328] 2007-09-09 05:59:01
1) regexp : expr
| '^' expr
| expr '$'
2) expr : expr '|' expr_without_or
| expr_without_or
3) expr_without_or : expr_without_or expr_without_concatenation
| expr_without_concatenation
4) expr_without_concatenation : term '*'
| term '+'
| term '?'
| term '{' dup '}'
5) dup : digit ',' digit
: digit ','
| digit
6) term : '[' string ']'
| '[' '^' string ']'
| '.'
| character
| '(' expr ')'
消除 2) 3) 的左递归
2.1) expr : expr_without_or expr0
2.2) expr0 : '|' expr_without_or expr0
|
3.1) expr_without_or : expr_without_concatenation expr_without_or0
3.2) expr_without_or0 : expr_without_concatenation expr_without_or
|
这里. character 为非空白字符
string 为 character 连接而成
digit 为 0-9
均由 lex scanner 产生
若你在年轻时上过水木, 它会一生跟随着你, 如一场浮动的盛宴
禁色和禁果仍被保存吗?
这世界有否给潜移默化?
离过家回了家仍住中环吗?
-----信有带到新居里烧吗?
一切美好的都会消失
人要是没有理想, 跟咸鱼有什么两样?
“把人们引向艺术和科学的最强烈动机之一,是要逃避日常生活中令人厌恶的粗俗和使人绝望的沉闷,是要摆脱人们自己反复无常的欲望的桎梏。一个修养有素的人总是渴望逃避个人生活而进入客观直觉和思维的世界。”
不要忘了,这个世界穿透一切高墙的东西,它就在我们的内心深处,他们无法达到,也接触不到,那就是希望。(FROM《肖申克的救赎》)