三叶香是什么菜| hpv是什么意思| 请节哀是什么意思| 扁桃体发炎用什么药| 7.1是什么星座| 化橘红是什么东西| 卤蛋吃多了有什么危害| nsa是什么意思| 时柱金舆是什么意思| 什么是狐臭| 舌苔发黄吃什么药| 腋下淋巴结挂什么科| 吃过饭后就想拉大便是什么原因| 双手抽筋是什么原因| 什么什么害命| 什么鸣什么盗| 为什么一个月来两次月经| 沙棘是什么| 忆苦思甜下一句是什么| 11月份是什么季节| 三颗星是什么军衔| 植物神经紊乱的症状吃什么药| 什么药吃了死的快| 减肥吃什么好而且瘦的快| 枕神经痛吃什么药| ect是什么意思| 兵戎相见是什么意思| 高考吃什么菜| 中央候补委员什么级别| 小狗不能吃什么| 腿上有白点是什么原因| 口缘字一半念什么| 任正非用的什么手机| 笔什么龙什么| 甲减吃什么食物好| 蝙蝠属于什么类| sm是什么意思啊| 腰椎间盘突出什么症状| 靶向治疗是什么| CRL是胎儿的什么意思| 微创人流和无痛人流有什么区别| 奚字五行属什么| 暂缓参军是什么意思| 强项是什么意思| 医学ac是什么意思| 海子是什么意思| 27属什么| 黄精药材有什么功效| 养肝护肝吃什么食物好| 8月15号是什么日子| 淋巴结是什么东西| 农历4月是什么星座| 胃溃疡吃什么水果| 近亲为什么不能结婚| 血糖高适合吃什么蔬菜| 南京市徽为什么是貔貅| 价值连城是什么意思| 女人脾肾两虚吃什么好| 大便不成形是什么原因造成的| 上火吃什么食物| 勤代表什么生肖| 儿童细菌感染吃什么药| zfc是什么牌子| 痛风吃什么药效果最好| 圹是什么意思| 耳朵旁边长痘痘是什么原因| 属狗的守护神是什么菩萨| 为什么性生活会出血| 蓝精灵是什么| 治疗晕病有什么好方法| 玩手机头疼是什么原因| bra是什么| 蛋糕裙搭配什么上衣| 水油是什么| 窦性心动过缓伴不齐是什么意思| 聚首一堂是指什么生肖| 什么什么分明的成语| 花木兰属什么生肖| 幽门螺杆菌吃什么药最好| 高诊是什么意思| 白细胞阳性是什么意思| 混纺棉是什么面料| 猕猴桃什么时候吃最好| 心里难受是什么原因| 脑白质变性是什么意思| 把碗打碎了有什么征兆| 黄芪长什么样子的图片| 办理护照需要什么| 血虚吃什么食物可以补| 各位同仁用在什么场合| 为什么得带状疱疹| 榴莲和什么不能一起吃| 水灵灵是什么意思| ms是什么意思| 灏是什么意思| 唇色深是什么原因| 芋圆是什么做的| 金融行业五行属什么| 看破红尘是什么意思| 邪魅是什么意思| 智齿是什么原因引起的| 黑曼巴是什么意思| 肺与大肠相表里是什么意思| 阴虚内热是什么意思| 羊水栓塞是什么意思| 乙肝第二针最晚什么时候打| 冬瓜有什么功效| 海蜇是什么动物| 一月十二号是什么星座| 黔驴技穷是什么意思| 见分晓是什么意思| 给事中是什么官| cn是什么意思啊| 公丁香和母丁香有什么区别| 什么不什么身| 混合痔是什么| 耍大牌是什么意思| 左室舒张功能减低是什么意思| 比基尼是什么意思| 对眼是什么意思| 右眼跳什么预兆| 引狼入室是什么意思| 排浊是什么意思| 11月份是什么星座| 竖心旁有什么字| 身体酸痛什么原因| 舌头火辣辣的是什么病| 水压低用什么花洒| 院士是什么学位| 直肠ca代表什么病| THENORTHFACE什么牌子| 梦见给别人理发是什么意思| 百依百顺是什么生肖| 老人脚浮肿是什么原因引起的| 上焦中焦下焦是什么| 锅底灰能治什么病| 菊花和金银花一起泡水有什么效果| 刷题是什么意思| 人为什么会自杀| 神经内科和神经外科有什么区别| 精子是什么味道的| 狗皮肤病用什么药| 气虚吃什么补最快| 脚趾甲变黑是什么原因| 扌字旁的字和什么有关| 马太效应是什么意思| 处女膜是什么样的| 龟头炎用什么| 三月24号是什么星座的| 勇气是什么| 为什么梦不到死去的亲人| 男生为什么喜欢摸胸| 偏光镜是什么意思| 绿豆有什么功效| 珝是什么意思| 小寒节气的含义是什么| 色弱是什么| 眼睛疼吃什么药效果最好| 穆斯林为什么不吃猪肉| 梦见干活是什么意思| 直升是什么意思| 病毒五项检查的是什么| 小孩晚上睡不着是什么原因| 喝什么能补肾| 安娜苏香水什么档次| 晦气是什么意思| 右脸颊长痘是什么原因| 耷拉是什么意思| 什么是血友病| 福寿延绵是什么意思| 健身rm是什么意思| 什么是偏印| 甲状腺球蛋白抗体高是什么意思| 内在美是什么意思| 鞋油自然色是什么颜色| 妈妈的妈妈叫什么| 根源是什么意思| 补铁吃什么维生素| 耳鸣是什么原因造成的| 什么的夏夜| 吃什么东西可以长高| 看病人买什么| ff是什么牌子| 女人排卵期有什么反应| 肠道感染有什么症状| 吃黄精有什么好处| 病理切片是什么意思| 身体游走性疼痛什么病| 舌苔发白是什么原因引起的| 佳人是什么生肖| 鬓角长痘痘是什么原因| 月黑见渔灯的见读什么| 疱疹性咽峡炎用什么药| 苦荞是什么| 幽门螺旋杆菌什么意思| 胆红素高说明什么| miu是什么单位| 808什么意思| 月亮杯是什么东西| pco2是什么意思| 高代表什么生肖| 什么的水流| 什么是亚健康| 葡萄是什么季节的水果| 梦见谈恋爱很甜蜜是什么意思| 梦见找孩子什么预兆| 记忆力减退是什么原因造成的| 孕期阴道炎可以用什么药| pci手术全称是什么| 医院介入科是干什么的| 征候是什么意思| tpp是什么意思| 打夜针是什么意思| 来例假吃什么食物好| zoom是什么| 卧推100公斤什么水平| 1964年是什么命| 事后紧急避孕药什么时候吃有效| 三文鱼不能和什么一起吃| 龙眼什么时候成熟| 大学毕业送什么花| 援交什么意思| 硬度不够吃什么好| 白带过氧化氢阳性是什么意思| 三点水加盆读什么| 吸狗是什么意思| 褪黑素什么时候吃| 5月28号是什么日子| 铺天盖地的意思是什么| 白血病是什么症状| 什么叫过渡句| 2.25是什么星座| 什么是房补| 汇字五行属什么| 什么是盆腔积液| 八院是什么医院| 一加是什么品牌| 阑尾炎挂什么科室| 笔走龙蛇是什么生肖| 1996年属什么| 起义是什么意思| 因公殉职是什么意思| 1936年是什么年| 对峙是什么意思| 5月4日是什么星座| 河豚有毒为什么还吃| vans属于什么档次| 头晕呕吐是什么原因引起的| 弊病是什么意思| 女人梦到蛇预示着什么| d表示什么| 西瓜虫吃什么食物| 天运子什么修为| 手淫过度吃什么药| 红斑狼疮是什么症状| 土字旁有什么字| 碰到蛇是什么征兆| 什么矿泉水最贵| mlf是什么意思| 身体突然消瘦是什么原因| 槟榔是什么味道的| 运动系统由什么组成| 6月13号是什么星座| 权衡是什么意思| 百度

Chapter?.燤inilanguages

Finding a Notation That Sings

Table of Contents

Understanding the Taxonomy of Languages
Applying Minilanguages
Case Study: sng
Case Study: Regular Expressions
Case Study: Glade
Case Study: m4
Case Study: XSLT
Case Study: The Documenter's Workbench Tools
Case Study: fetchmail Run-Control Syntax
Case Study: awk
Case Study: PostScript
Case Study: bc and dc
Case Study: Emacs Lisp
Case Study: JavaScript
Designing Minilanguages
Choosing the Right Complexity Level
Extending and Embedding Languages
Writing a Custom Grammar
Macros — Beware!
Language or Application Protocol?

A good notation has a subtlety and suggestiveness which at times makes it almost seem like a live teacher.

-- Bertrand Russell The World of Mathematics (1956)

One of the most consistent results from large-scale studies of error patterns in software is that programmer error rates in defects per hundreds of lines are largely independent of the language in which the programmers are coding.[78] Higher-level languages, which allow you to get more done in fewer lines, mean fewer bugs as well.

Unix has a long tradition of hosting little languages specialized for a particular application domain, languages that can enable you to drastically reduce the line count of your programs. Domain-specific language examples include the numerous Unix typesetting languages (troff, eqn, tbl, pic, grap), shell utilities (awk, sed, dc, bc), and software development tools (make, yacc, lex). There is a fuzzy boundary between domain-specific languages and the more flexible sort of application run-control file (sendmail, BIND, X); another with data-file formats; and another with scripting languages (which we'll survey in Chapter?4).

Historically, domain-specific languages of this kind have been called ‘little languages’ or ‘minilanguages’ in the Unix world, because early examples were small and low in complexity relative to general-purpose languages (all three terms for the category are in common use). But if the application domain is complex (in that it has lots of different primitive operations or involves manipulation of intricate data structures), an application language for it may have to be rather more complex than some general-purpose languages. We'll keep the traditional term ‘minilanguage’ to emphasize that the wise course is usually to keep these designs as small and simple as possible.

The domain-specific little language is an extremely powerful design idea. It allows you to define your own higher-level language to specify the appropriate methods, rules, and algorithms for the task at hand, reducing global complexity relative to a design that uses hardwired lower-level code for the same ends. You can get to a minilanguage design in at least three ways, two of them good and one of them dangerous.

One right way to get there is to realize up front that you can use a minilanguage design to push a given specification of a programming problem up a level, into a notation that is more compact and expressive than you could support in a general-purpose language. As with code generation and data-driven programming, a minilanguage lets you take practical advantage of the fact that the defect rate in your software will be largely independent of the level of the language you are using; more expressive languages mean shorter programs and fewer bugs.

The second right way to get to a minilanguage design is to notice that one of your specification file formats is looking more and more like a minilanguage — that is, it is developing complex structures and implying actions in the application you are controlling. Is it trying to describe control flow as well as data layouts? If so, it may be time to promote that control flow from being implicit to being explicit in your specification language.

The wrong way to get to a minilanguage design is to extend your way to it, one patch and crufty added feature at a time. On this path, your specification file keeps sprouting more implied control flow and more tangled special-purpose structures until it has become an ad-hoc language without your noticing it. Some legendary nightmares have been spawned this way; the example every Unix guru will think of (and shudder over) is the sendmail.cf configuration file associated with the sendmail mail transport.

Sadly, most people do their first minilanguage the wrong way, and only realize later what a mess it is. Then the question is: how to clean it up? Sometimes the answer implies rethinking the entire application design. Another notorious example of language-by-feature creep was the editor TECO, which grew first macros and then loops and conditionals as programmers wanted to use it to package increasingly complex editing routines. The resulting ugliness was eventually fixed by a redesign of the entire editor to be based on an intentional language; this is how Emacs Lisp (which we'll survey below) evolved.

All sufficiently complicated specification files aspire to the condition of minilanguages. Therefore, it will often be the case that your only defense against designing a bad minilanguage is knowing how to design a good one. This need not be a huge step or involve knowing a lot of formal language theory; with modern tools, learning a few relatively simple techniques and bearing good examples in mind as you design should be sufficient.

In this chapter we'll examine all the kinds of minilanguages normally supported under Unix, and try to identify the kinds of situation in which each of them represents an effective design solution. This chapter is not meant to be an exhaustive catalog of Unix languages, but rather to bring out the design principles involved in structuring an application around a minilanguage. We'll have much more to say about languages for general-purpose programming in Chapter?4.

We'll need to start by doing a little taxonomy, so we'll know what we're talking about later on.



[78] Les Hatton reports by email on the analysis in his book in preparation, Software Failure: “Provided you use executable line counts for the density measure, the injected defect densities vary less between languages than they do between engineers by about a factor of 10”.

榴莲什么时候成熟 舌苔厚口臭吃什么药好 三角梅什么时候开花 肺纤维化有什么症状 头痛眼睛痛什么原因引起的
3.8号是什么星座 宫颈纳囊是什么病 血压低压高吃什么药 白细胞偏低吃什么 高玩是什么意思
儿郎是什么意思 n0是什么意思 嗓子疼喝什么药 臭氧是什么东西 口腔溃疡缺什么维生素
0是什么 志五行属什么 投胎什么意思 榴莲是什么季节的水果 液氮是什么
2月30日是什么星座hcv8jop4ns4r.cn 肚子上方中间疼是什么部位hcv8jop1ns1r.cn 肚脐右边疼是什么原因cj623037.com 左肾轻度积水是什么意思hcv8jop8ns9r.cn 玉髓是什么材质cj623037.com
什么狗不掉毛适合家养zsyouku.com 男人更年期吃什么药hcv8jop2ns8r.cn bebe是什么意思hcv9jop0ns1r.cn 酿酒用什么菌hcv8jop0ns7r.cn 半月板损伤有什么症状hcv8jop0ns2r.cn
井盖为什么是圆的hcv7jop9ns5r.cn 蔬菜沙拉都放什么菜hcv7jop9ns9r.cn 腐竹炒什么好吃hcv8jop1ns8r.cn 征文是什么hcv9jop4ns7r.cn 古井贡酒是什么香型hcv8jop1ns3r.cn
肝的主要功能是什么bjhyzcsm.com 就不告诉你就不告诉你是什么儿歌hcv8jop6ns7r.cn 做梦梦到鬼是什么意思hcv8jop4ns6r.cn 蒲公英什么功效hcv7jop6ns9r.cn 嗪读什么hcv9jop1ns3r.cn
百度