治霉菌性阴炎用什么药好得快| 鼾症是什么病| 总胆红素高是什么意思| 肛门周边瘙痒擦什么药| 腺病是什么意思| 越南有什么特产| 为什么经常口腔溃疡| 无可厚非什么意思| robot什么意思| 白塞氏病是什么病| 孕妇吃什么鱼| 用什么水和面烙饼最软| 头孢不能和什么食物一起吃| 无以言表是什么意思| 9月3号什么日子| 壁虎进家里预示什么| 什么虫子咬了像针扎一样疼| 百合的花语是什么| 邓超是什么星座| 后顶焦度是什么意思| 广西狗肉节是什么时候| 46什么意思| 转念是什么意思| 壮阳吃什么| 什么酒不能喝| 胆囊切除有什么危害| 头晕想睡觉是什么原因| 梦见自己扫地是什么意思| 跪安是什么意思| 推举是什么意思| 清洁度1度是什么意思| 666代表什么意思| 生活的意义是什么| 10月13是什么星座| 多发肿大淋巴结是什么意思| 皮肤上有小白斑点是什么原因| 爱吃酸的人是什么体质| 血管是什么组织| 衣衫褴褛是什么意思| 什么药治咳嗽最好| 喝酒吃什么解酒| 桡神经受损有什么恢复的方法| 高血压什么症状| 癫痫是什么| 口若什么| 背包客是什么意思| 引狼入室是什么意思| 月经来了不能吃什么东西| 孕初期需要注意些什么| 寿辰是什么意思| 今晚吃什么家常菜| 黄猫来家里有什么预兆| 闰六月有什么讲究| 妄想症有什么症状| 什么的糖果| 艾滋病人有什么特征| 小人是什么意思| 顶格是什么意思| 老二是什么意思| 脂肪最终被消化成什么| 狐仙一般找什么人上身| 舌尖有点麻是什么原因| 梦到鸡是什么意思| 市盈率是什么意思| 小便分叉是什么症状| 胎动少是什么原因| s.m什么意思| 媛交是什么意思| 息肉是什么原因引起的| 壁虎喜欢吃什么| 舌苔发白是什么问题| 狗狗能看见什么颜色| 做梦杀人了是什么征兆| p代表什么| 梦到亲人死了是什么征兆| 北京大学校长是什么级别| 女性尿里带血是什么原因| 东莞五行属什么| 空调买什么牌子好| 皮肤爱出油是什么原因| 跑团是什么| 3月26日是什么节日| 绿豆汤为什么是红色的| 什么原因会导致尿路感染| 省军区司令员是什么级别| 腿抽筋缺什么| ac什么意思| 霍金是什么病| 艾滋病挂什么科| 斑鸠吃什么| 扑尔敏又叫什么| 长时间憋尿会有什么影响| 野趣是什么意思| 就让我爱你把你捧在手心里是什么歌| 衍心念什么| 齐活儿是什么意思| 卡他症状是什么意思| 一阴一阳是什么生肖| 年轻人为什么会低血压| 换肾是什么病| 什么虫咬了起水泡| 藏干是什么意思| 易胖体质是什么原因造成的| 急性上呼吸道感染吃什么药| 什么是霸凌| ppl是什么意思| 湿气用什么药最好最快| 什么茶最好| 先敬罗衣后敬人是什么意思| 尿常规挂什么科| 胃复安又叫什么| 炸酥肉用什么粉| 尤物是什么意思| 白矾是什么东西| 低血糖有什么症状表现| com代表什么意思| 桂花什么时候开| 六合是什么意思| 支气管炎吃什么药好得快| 体检应该挂什么科| apc是什么药| 带翅膀的黑蚂蚁是什么| 汉语拼音是什么时候发明的| 皮肤属于什么组织| 躺平是什么意思| 猫的偏旁叫什么| 看淡一切对什么都没兴趣| ori是什么意思| 什么是植物神经紊乱| n是什么| 婴幼儿湿疹用什么药膏最有效| 弯男是什么意思| 科颜氏属于什么档次| 炜字五行属什么| 右肺上叶为什么恶性多| 十月份是什么季节| 鸭子炖汤和什么一起炖最有营养| 2月16日是什么星座| 为什么白醋把纹身洗掉了| 韩红什么军衔| 竹叶青属于什么茶| 什么颜色加什么颜色等于紫色| 心神不定是什么生肖| 水蚤吃什么| 看破红尘是什么意思| 1953年属蛇的是什么命| 暗娼什么意思| 为什么会打哈欠| polo衫是什么| 湖南简称什么| 菀字五行属什么| 一九九二年属什么生肖| 为什么会停电| 什么油炒菜好吃又健康| 肾宝片是什么| 舌头发热是什么原因| 痛风用什么药治疗最好| 1月19日什么星座| 早搏是什么| 大海是什么颜色| 慢性胰腺炎有什么症状| 什么是人肉搜索| 泮是什么意思| 重孙是什么意思| 买车置换是什么意思| 鼠目寸光是什么意思| 鼻鼽病是什么意思| 臣附议是什么意思| 倒钩是什么意思| 2018年属什么生肖| 母乳什么味道| 啊哈是什么意思| 拿东西手抖是什么原因| 呼吸内镜检查什么| 品鉴是什么意思| 什么是偏光眼镜| 梵高的星空表达了什么| 外感风寒是什么意思| 怀孕初期吃什么食物好| 乙肝表面抗体偏高是什么意思| 煞星是什么意思| 羊水暗区是什么意思| 凭什么| 健脾丸和归脾丸有什么区别| 阴部痒是什么原因| 系统性红斑狼疮是什么病| 小孩子注意力不集中是什么原因| 海底椰是什么东西| 脾肾阳虚吃什么药| 春茶是什么茶| 脂溢性皮炎有什么症状| dha什么时候吃最好| 额窦炎吃什么药效果好| 鑫字属于五行属什么| 心律不齐什么症状| apm是什么意思| 茶色尿液提示什么病| 小舅子是什么意思| 白芷长什么样图片| 梦见已故的老人是什么意思| 一什么清香| 人怕出名猪怕壮是什么生肖| ahc是什么牌子| 肚子疼吃什么消炎药| 拉肚子能吃什么| 通透是什么意思| 艾滋病是一种什么病| 因应是什么意思| 金国人是现在的什么人| 生物制剂对人体有什么副作用| 经常感冒吃什么提高免疫力| 包皮龟头炎吃什么药| 心包积液挂什么科| 气滞血瘀吃什么中成药| 象牙有什么作用与功效| 腮腺炎不能吃什么东西| 查染色体的目的是什么| 牙齿有黑洞是什么原因| 抗链球菌溶血素o偏高是什么原因| 吃什么奶水会增多| 为什么会无缘无故长痣| 脑白质病变吃什么药| 初音未来是什么| 6月28是什么星座| 为什么六月腊月不搬家| 鳞状上皮内高度病变什么意思| 春指什么生肖| 榴莲和什么不能一起吃| 减肥早上吃什么| 嫩绿的什么| 龙代表什么数字| 伤口消毒用什么好| 卡马西平是什么药| 一什么地毯| 沐雨栉风是什么生肖| 扁桃是什么水果| 梦见老婆出轨是什么预兆| 什么头什么面| 肋骨外翻是什么原因| 妊娠阴性是什么意思| 不知餍足什么意思| 八卦分别代表什么| 尿隐血3十是什么病| 马粟是什么| 女性尿液发黄是什么原因| 口腔苦味是什么原因| 1959属什么生肖| 减肥为什么不让吃茄子| 变白吃什么| 鹿茸有什么作用| 硝化细菌是什么| 乳腺瘤不能吃什么| 低聚糖是什么| 盘核桃有什么好处| 为什么嗓子总有痰| 1962年属什么生肖| 宫腔镜手术是什么原因才要做| 12月17号什么星座| 大姨妈来吃什么水果好| 四个金读什么| 叶公好龙的寓意是什么| 十三是什么意思| 吃什么补黄体酮| 黄眉大王是什么妖怪| 百度Jump to content

考研前辈考试心得:复习之前,你的计划很重要

From Wikipedia, the free encyclopedia
(Redirected from Lexical preprocessor)
百度 巡航导弹搭载高精确弹头,依靠雷达和高效信息传递技术,能够在短时间内完成发射准备。

In computer science, a preprocessor (or precompiler)[1] is a program that processes its input data to produce output that is used as input in another program. The output is said to be a preprocessed form of the input data, which is often used by some subsequent programs like compilers. The amount and kind of processing done depends on the nature of the preprocessor; some preprocessors are only capable of performing relatively simple textual substitutions and macro expansions, while others have the power of full-fledged programming languages.

A common example from computer programming is the processing performed on source code before the next step of compilation. In some computer languages (e.g., C and PL/I) there is a phase of translation known as preprocessing. It can also include macro processing, file inclusion and language extensions.

Lexical preprocessors

[edit]

Lexical preprocessors are the lowest-level of preprocessors as they only require lexical analysis, that is, they operate on the source text, prior to any parsing, by performing simple substitution of tokenized character sequences for other tokenized character sequences, according to user-defined rules. They typically perform macro substitution, textual inclusion of other files, and conditional compilation or inclusion.

C preprocessor

[edit]

The most common example of this is the C preprocessor, which takes lines beginning with '#' as directives. The C preprocessor does not expect its input to use the syntax of the C language. Some languages take a different approach and use built-in language features to achieve similar things. For example:

  • Instead of macros, some languages use aggressive inlining and templates.
  • Instead of includes, some languages use compile-time imports that rely on type information in the object code.
  • Some languages use if-then-else and dead code elimination to achieve conditional compilation.

Other lexical preprocessors

[edit]

Other lexical preprocessors include the general-purpose m4, most commonly used in cross-platform build systems such as autoconf, and GEMA, an open source macro processor which operates on patterns of context.

Syntactic preprocessors

[edit]

Syntactic preprocessors were introduced with the Lisp family of languages. Their role is to transform syntax trees according to a number of user-defined rules. For some programming languages, the rules are written in the same language as the program (compile-time reflection). This is the case with Lisp and OCaml. Some other languages rely on a fully external language to define the transformations, such as the XSLT preprocessor for XML, or its statically typed counterpart CDuce.

Syntactic preprocessors are typically used to customize the syntax of a language, extend a language by adding new primitives, or embed a domain-specific programming language (DSL) inside a general purpose language.

Customizing syntax

[edit]

A good example of syntax customization is the existence of two different syntaxes in the Objective Caml programming language.[2] Programs may be written indifferently using the "normal syntax" or the "revised syntax", and may be pretty-printed with either syntax on demand.

Similarly, a number of programs written in OCaml customize the syntax of the language by the addition of new operators.

Extending a language

[edit]

The best examples of language extension through macros are found in the Lisp family of languages. While the languages, by themselves, are simple dynamically typed functional cores, the standard distributions of Scheme or Common Lisp permit imperative or object-oriented programming, as well as static typing. Almost all of these features are implemented by syntactic preprocessing, although it bears noting that the "macro expansion" phase of compilation is handled by the compiler in Lisp. This can still be considered a form of preprocessing, since it takes place before other phases of compilation.

Specializing a language

[edit]

One of the unusual features of the Lisp family of languages is the possibility of using macros to create an internal DSL. Typically, in a large Lisp-based project, a module may be written in a variety of such minilanguages, one perhaps using a SQL-based dialect of Lisp, another written in a dialect specialized for GUIs or pretty-printing, etc. Common Lisp's standard library contains an example of this level of syntactic abstraction in the form of the LOOP macro, which implements an Algol-like minilanguage to describe complex iteration, while still enabling the use of standard Lisp operators.

The MetaOCaml preprocessor/language provides similar features for external DSLs. This preprocessor takes the description of the semantics of a language (i.e. an interpreter) and, by combining compile-time interpretation and code generation, turns that definition into a compiler to the OCaml programming language—and from that language, either to bytecode or to native code.

General purpose preprocessor

[edit]

Most preprocessors are specific to a particular data processing task (e.g., compiling the C language). A preprocessor may be promoted as being general purpose, meaning that it is not aimed at a specific usage or programming language, and is intended to be used for a wide variety of text processing tasks.

M4 is probably the most well known example of such a general purpose preprocessor, although the C preprocessor is sometimes used in a non-C specific role. Examples:

  • using C preprocessor for JavaScript preprocessing.[3][4]
  • using C preprocessor for devicetree processing within the Linux kernel.[5]
  • using M4 (see on-article example) or C preprocessor[6] as a template engine, to HTML generation.
  • imake, a make interface using the C preprocessor, written for the X Window System but now deprecated in favour of automake.
  • grompp, a preprocessor for simulation input files for GROMACS (a fast, free, open-source code for some problems in computational chemistry) which calls the system C preprocessor (or other preprocessor as determined by the simulation input file) to parse the topology, using mostly the #define and #include mechanisms to determine the effective topology at grompp run time.

See also

[edit]

References

[edit]
  1. ^ "What is a precompiler?". IBM.
  2. ^ The Revised syntax from The Caml language website
  3. ^ Show how to use C-preprocessor on JavaScript files. "JavaScript is Not Industrial Strength" by T. Snyder.
  4. ^ "The C Preprocessor in Javascript?". espresso-mode.
  5. ^ "Kernel/Git/Stable/Linux.git - Linux kernel stable tree".
  6. ^ Show how to use C-preprocessor as template engine. "Using a C preprocessor as an HTML authoring tool" by J. Korpela, 2000.
[edit]
早上打喷嚏是什么预兆 洁面液是干什么用的 烫伤起水泡涂什么药膏 梦见买帽子是什么意思 含蓄什么意思
总放屁还特别臭是什么原因 另煎兑服是什么意思 ccs是什么意思 青海湖里面有什么鱼 孕中期宫缩是什么感觉
掌心有痣代表什么 土方是什么 阴盛格阳是什么意思 dragon是什么意思 牙龈萎缩吃什么药见效快
为什么起荨麻疹 为什么减肥一直减不下来 眼睛肿是什么问题 海菜是什么 潜伏是什么意思
你干什么呢hcv8jop6ns0r.cn 碱是什么意思hcv7jop6ns3r.cn 胆囊切除后吃什么好hcv9jop6ns8r.cn 看近视眼挂什么科hcv9jop6ns4r.cn 芈姝结局是什么hcv7jop9ns2r.cn
梦见考试是什么预兆hcv8jop2ns1r.cn 长时间手淫有什么危害hcv8jop9ns1r.cn 胃酸是什么酸hcv9jop3ns6r.cn 怀孕期间吃什么对胎儿发育好hcv7jop9ns0r.cn 夜明珠代表什么生肖liaochangning.com
东施效颦什么意思hcv8jop2ns4r.cn 拍大腿内侧有什么好处hcv9jop2ns2r.cn 胡桃木色是什么颜色hcv7jop9ns4r.cn 奋不顾身的顾是什么意思hcv8jop8ns1r.cn 叶酸在什么食物里最多hcv7jop7ns0r.cn
肾盂肾炎吃什么药hcv9jop6ns6r.cn 胃窦糜烂是什么意思严重吗hcv9jop3ns0r.cn 孟母三迁告诉我们什么道理hcv8jop8ns0r.cn kelme是什么牌子hcv9jop2ns2r.cn 隐翅虫皮炎用什么药dayuxmw.com
百度