![]() |
|
Clear questions and runnable code get the best and fastest answer |
|
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
|
|
乳头痒是怎么回事是什么原因 | 吃什么补内膜最快 | 口干舌燥挂什么科 | 腰椎间盘突出挂什么科室 | 柠檬有什么功效和作用 |
刷酸是什么 | otg线是什么 | 南海龙王叫什么 | 云为什么是白色的 | 为什么要备孕 |
无头鱼是什么鱼 | 月亮的肚子指的是什么 | 女性体毛多是什么原因 | 西洋菜是什么菜 | 维生素c是什么 |
拔牙后注意什么 | 非经期出血是什么原因 | 自古红颜多薄命是什么意思 | 狗可以吃什么水果 | 华为什么手机好 |
处女和什么座最配对hcv9jop6ns5r.cn | 血小板分布宽度偏低是什么意思hcv8jop0ns5r.cn | gsy什么意思zsyouku.com | 舅舅的儿子叫什么hcv8jop9ns9r.cn | 羊悬筋是什么样子图片hcv9jop5ns4r.cn |
血小板低会出现什么症状onlinewuye.com | 七月七日是什么生肖520myf.com | 24岁属什么hcv8jop7ns5r.cn | 什么什么闻名hcv8jop2ns9r.cn | 梦见小麦粒是什么意思hcv9jop3ns5r.cn |
手机什么时候发明的hcv8jop0ns9r.cn | 舅子是什么意思hcv7jop7ns4r.cn | 屁臭是什么原因hcv9jop1ns2r.cn | 鼻咽部淋巴组织增生是什么意思hcv9jop1ns9r.cn | cp什么意思网络用语hcv8jop0ns5r.cn |
牙龈紫色是什么原因hcv9jop5ns6r.cn | 什么是双相情感障碍hcv8jop9ns4r.cn | 什么人不能喝绿豆汤hcv7jop9ns9r.cn | 99年属什么hcv9jop5ns1r.cn | today什么意思hcv7jop9ns0r.cn |