![]() |
|
We don't bite newbies here... much | |
PerlMonks |
On Parsing Perlby merlyn (Sage) |
on Dec 04, 2000 at 04:21 UTC ( [id://44722]=perlmeditation: print w/replies, xml ) | Need Help?? |
{from an alt.perl post I just made, reposted here to solicit feedback from fellow monks...}
Perl is extremely difficult to parse. In fact, some would say impossible. One thing that makes it difficult is the dual nature of a half dozen characters like "/". If that / is being used in a place that's expecting an operator, it's divide. If it's being used in a place that's expecting an operand, it's the beginning of a regular expression. So you have to keep track at all times of whether you're looking for an operator or an operand. "No problem", you say? Quick... for the following, play the game of "regex or divide?" Got those right? How about these? OK, and now some of your own: Got those too? How about these (same problem, different file): A little harder, eh? So now you have to parse OUTSIDE the file to get your answer. And as if that wasn't enough, let's get weird: Quick, was that last one a divide or a regex start? Why does it matter? Look at this: The first one is computing the sin of the true/false value gotten by matching " 25 ; # " against $_. Then it dies. The second one is computing the time of day divided by 25, then ignoring the comment. Starting to see the trouble? This leads people to say "the only thing which can parse Perl (the language) is perl (the binary)". Maybe not for Perl6. But for the Perl we know and can use today, certainly so. -- Randal L. Schwartz, Perl hacker
Back to
Meditations
|
|
盲从什么意思 | 6月29什么星座 | 梅花象征着什么 | 黑枸杞泡茶是什么颜色 | 医疗美容需要什么资质 |
新疆有什么特产 | 为什么吃饱了就犯困 | 胜利在什么 | 扒灰是什么意思 | 什么中毒查不出来 |
肺部斑片状高密度影是什么意思 | 满载而归的载是什么意思 | 前列腺液是什么东西 | 什么床不能睡觉 | 剁椒是什么辣椒 |
有氧运动和无氧运动有什么区别 | 心慌吃什么药能缓解 | 精索静脉曲张是什么 | 八哥鸟吃什么 | 手心痒是什么原因 |
八面玲珑指什么生肖hcv7jop6ns4r.cn | 左肾积水有什么症状hcv9jop7ns9r.cn | 上海有什么景点hcv9jop8ns3r.cn | 琼字代表什么生肖hcv8jop5ns1r.cn | 为什么英文怎么写hcv8jop1ns9r.cn |
女的肾虚是什么原因引起的hcv9jop7ns0r.cn | 破伤风是什么意思hcv9jop0ns5r.cn | 走路脚后跟疼是什么原因wmyky.com | 什么是戒断反应hcv9jop4ns6r.cn | 神经性皮炎不能吃什么食物hcv8jop7ns7r.cn |
做梦拉粑粑是什么意思hcv9jop3ns5r.cn | 拔罐拔出水是什么原因hcv7jop5ns0r.cn | 早上起来腰疼是什么原因hcv8jop3ns7r.cn | 农历六月十五是什么星座hcv7jop9ns9r.cn | 方圆什么意思hcv8jop6ns1r.cn |
吃什么精力旺盛有精神520myf.com | 精益求精的意思是什么hcv8jop2ns1r.cn | pes是什么材质hcv9jop3ns2r.cn | 囊性无回声是什么意思hcv9jop2ns8r.cn | 藕是莲的什么部位xinmaowt.com |