女性尿血是什么原因| 三五成群是什么意思| 什么属相不适合养鱼| 什么事情只能用一只手去做| esd是什么| 井代表什么生肖| 生机勃勃什么意思| 祛火喝什么茶| 什么的日子| 颈椎ct能检查出什么| 为什么一直不怀孕是什么原因| 内膜增厚是什么原因| 喰种是什么意思| 震楼神器楼上什么感觉| 西瓜什么时候传入中国| 十一月三号是什么星座| 棚改是什么意思| 高汤是什么汤| 心功能iv级是什么意思| 宣是什么意思| 耳鸣是什么意思| 梦见尸体是什么意思| 扫描件是什么意思| 蜜蜂蛰了用什么药| 梦见炖鱼预示什么| 985和211有什么区别| 柯字五行属什么| 剩女什么意思| 分泌物过氧化氢阳性是什么意思| dpoy什么意思| 女生剪什么短发好看| 四海扬名是什么生肖| 非农业户口是什么意思| 为什么会得肺结核| 做完人流可以吃什么| 出水痘吃什么药| 宝宝咳嗽吃什么药好| 孕妇吃花生对胎儿有什么好处| 口腔溃疡吃什么好的快| 金木水火土各代表什么| 叉烧是什么肉| 什么东西化痰效果最好最快| 世界上最难写的字是什么| 女生取什么名字好听| 为什么月经前乳房胀痛| 818是什么星座| 菜板什么木材最好| 丧偶什么意思| 小儿咳嗽吃什么药好| 狂狷是什么意思| 风寒吃什么感冒药| 冷暴力是什么| 什么地站着| 小孩黄疸是什么原因引起的| 丰的部首是什么偏旁| 室内用什么隔墙最便宜| 有机酸是什么| 桃子不能和什么食物一起吃| 八面玲珑是什么意思| cvd是什么意思| 直接胆红素偏低是什么原因| 为什么今年夏天特别热| 辣椒是什么生肖| 紫癜是什么病严重吗| 甲状腺结节用什么药| 护理专业是干什么的| 脸皮最厚是什么生肖| 熟啤酒是什么意思| 乙肝表面抗原阳性是什么意思| 脑梗看什么科| 夏至吃什么传统食物| 心律不齐吃什么食物好| 6月29日什么星座| 口腔义齿是什么| 智齿痛吃什么药| 羊蝎子是什么东西| 肾动脉狭窄有什么症状| 不洁是什么意思| 圣诞节的礼物什么时候送| 买手是什么职业| 什么水果最贵| 受凉胃疼吃什么药| 鸟语花香是什么生肖| 排场是什么意思| 什么是医美| 血糖高对身体有什么危害| 青是什么颜色| 9.3什么星座| 天仙是什么意思| 灵修是什么意思| 什么菜降血压效果最好| 单核细胞高是什么感染| 梦到生男孩有什么预兆| 1月28日什么星座| 氟西汀是什么药| 美尼尔综合征是什么原因引起的| 来年是什么意思| 将军是什么级别| 今年43岁属什么| 潘驴邓小闲什么意思| 亚临床甲减是什么意思| 胆囊壁厚是什么意思| 珍惜眼前人是什么意思| 梦见玉米是什么意思| 角弓反张是什么意思| 微信附近的人都是些什么人| 什么是微单相机| 吃什么能提高记忆力| 长疱疹是什么原因| 肠胃痉挛吃什么药| 抽烟肺疼是什么原因| 1992属什么生肖| 最近我和你都有一样的心情什么歌| 什么的肩膀| bic是什么意思| 奶阵是什么意思| 南方有什么生肖| 什么时候需要做肠镜| 冰粉的原材料是什么| 手淫多了有什么坏处| 一月十八是什么星座| 毛是什么意思| 舅舅的女儿叫什么| 蛇喜欢吃什么| 猫咖是什么| feel什么意思| 2.1是什么星座| 格斗和散打有什么区别| ricoh什么牌子| 刘少奇属什么生肖| 儿童矮小挂什么科| 颅骨早闭合有什么症状| 隐血试验阴性是什么意思| 道士是干什么的| 昏昏欲睡是什么意思| 一抹多是什么意思| 精美的什么| 乳腺瘤是什么引起的| 洋地黄中毒首选什么药| 邮编什么意思| cancer是什么意思| 肝炎是什么原因引起的| dha中文叫什么| 面诊是什么意思| 副乳是什么| 属猴的幸运色是什么颜色| 海螺吃什么食物| 湖北人喜欢吃什么菜| 雀舌属于什么茶| 脑ct都能查出什么病| 八0年属什么生肖| 北京是我国的什么中心| 上海新华医院擅长什么| 梦见蟒蛇是什么意思| 判决书什么时候生效| 蜂蜜加柠檬有什么功效和作用| 叟是什么意思| 虚恋是什么意思| 闻香识女人是什么意思| 生肠是什么| 空腹喝酒有什么危害| 后脖子出汗多是什么原因| 早上7点到9点是什么时辰| gold是什么意思| 衣原体阳性是什么病| 布洛芬有什么作用| 备孕要注意什么| 76年属什么生肖| 高血糖吃什么水果最好| BORDEAUX是什么红酒| 珊五行属什么| 儿童红眼病用什么眼药水| 10年属什么生肖| 咳嗽有黄痰吃什么消炎药| 警察是什么生肖| 黄芪和枸杞泡水喝有什么作用| 云吞是什么| n字鞋子是什么牌子| 骨关节疼痛什么原因| 吃什么去黄气美白| 银耳不能和什么一起吃| 甲减长期服用优甲乐有什么危害| 椎间盘突出挂什么科| 高密度脂蛋白胆固醇偏低是什么意思| 副县长什么级别| a型血和什么血型生出o型血| 结节性红斑吃什么药| 什么眉什么目| 乾字五行属什么| tr是什么| 唐筛都检查什么| 小厨宝是什么| 什么是弱视| 腿上出汗是什么原因| 性激素是什么意思| 爸爸的爸爸叫什么| 懿怎么读 什么意思| 什么是框架协议| 不过是什么意思| 夜郎自大是什么意思| 什么魂什么魄| 后半夜咳嗽是什么原因| 大圣归来2什么时候上映| 珍珠鸟是什么鸟| 什么食物补血效果最好最快| 狗子是什么意思| 近视用什么镜矫正| 石斛起什么作用| 软著是什么| 去湿气吃什么食物好| 肌酐测定低是什么意思| 自来水养鱼为什么会死| 什么是工作性质| 西林是什么药| 矫枉过正什么意思| 月经不调挂什么科室| 什么是陈述句| pab是什么意思| 焦虑会引起什么症状| 菩提根是什么| 琼瑶什么意思| 肺栓塞有什么症状| 穷搬家富挪坟是什么意思| 造瘘手术是什么意思| 宝宝有口臭是什么原因引起的| 3p 什么意思| 什么是资本家| 佛心果是什么东西| 觉悟高是什么意思| 来月经不能吃什么水果| 羊跟什么生肖最配| 蛋白烫发是什么意思| 为什么会面瘫| 骨皮质是什么| 天秤和什么星座最配| 下午六点半是什么时辰| 石见读什么| 乙肝小二阳是什么意思| 什么食物防辐射| 梦见自己拉了很多屎是什么意思| 肠道蠕动慢吃什么药| 菱角什么时候成熟| 人为什么会打哈欠| 血小板减少会出现什么症状| 卧底大结局是什么| 小儿湿疹是什么原因造成的| 一什么青蛙| 股癣用什么药膏好得快| 吃什么丰胸效果好又快| 糖耐什么时候检查| 五常法指的是什么| copd是什么意思| 成人改名字需要什么手续| 做梦梦到蜈蚣是什么意思| 猫发烧吃什么药| 守护者是什么意思| ict是什么意思| 做b超挂什么科| 蒙脱石散是什么成分| 牡丹是什么季节开的| 血氧是什么意思| 左膝关节退行性变是什么意思| 碱性食物都有什么| 刺梨有什么功效| 百度Jump to content

艾慕内衣【十多项专利】品质服务,诚招加盟!

From Wikipedia, the free encyclopedia
百度 抓反腐倡廉教育,促进拒腐能力增强。

An operator precedence grammar is a kind of grammar for formal languages.

Technically, an operator precedence grammar is a context-free grammar that has the property (among others)[1] that no production has either an empty right-hand side or two adjacent nonterminals in its right-hand side. These properties allow precedence relations to be defined between the terminals of the grammar. A parser that exploits these relations is considerably simpler than more general-purpose parsers, such as LALR parsers. Operator-precedence parsers can be constructed for a large class of context-free grammars.

Precedence relations

[edit]

Operator precedence grammars rely on the following three precedence relations between the terminals:[2]

Relation Meaning
a yields precedence to b
a has the same precedence as b
a takes precedence over b

These operator precedence relations allow to delimit the handles in the right sentential forms: marks the left end, appears in the interior of the handle, and marks the right end. Contrary to other shift-reduce parsers, all nonterminals are considered equal for the purpose of identifying handles.[3] The relations do not have the same properties as their un-dotted counterparts; e. g. does not generally imply , and does not follow from . Furthermore, does not generally hold, and is possible.

Let us assume that between the terminals ai and ai+1 there is always exactly one precedence relation. Suppose that $ is the end of the string. Then for all terminals b we define: and . If we remove all nonterminals and place the correct precedence relation: , , between the remaining terminals, there remain strings that can be analyzed by an easily developed bottom-up parser.

Example

[edit]

For example, the following operator precedence relations can be introduced for simple expressions:[4]

They follow from the following facts:[5]

  • + has lower precedence than * (hence and ).
  • Both + and * are left-associative (hence and ).

The input string[4]

after adding end markers and inserting precedence relations becomes

Operator precedence parsing

[edit]

Having precedence relations allows to identify handles as follows:[4]

  • scan the string from left until seeing
  • scan backwards (from right to left) over any until seeing
  • everything between the two relations and , including any intervening or surrounding nonterminals, forms the handle

It is generally not necessary to scan the entire sentential form to find the handle.

Operator precedence parsing algorithm

[edit]

The algorithm below is from Aho et al.:[6]

If $ is on the top of the stack and ip points to $ then return
else
    Let a be the top terminal on the stack, and b the symbol pointed to by ip
    if a  b or a  b then
        push b onto the stack
        advance ip to the next input symbol
    else if a  b then
        repeat
            pop the stack
        until the top stack terminal is related by  to the terminal most recently popped
    else error()
end

Precedence functions

[edit]

An operator precedence parser usually does not store the precedence table with the relations, which can get rather large. Instead, precedence functions f and g are defined.[7] They map terminal symbols to integers, and so the precedence relations between the symbols are implemented by numerical comparison: ?? must hold if holds, etc.

Not every table of precedence relations has precedence functions, but in practice for most grammars such functions can be designed.[8]

Algorithm for constructing precedence functions

[edit]

The below algorithm is from Aho et al.:[9]

  1. Create symbols fa and ga for each grammar terminal a and for the end of string symbol;
  2. Partition the created symbols in groups so that fa and gb are in the same group if (there can be symbols in the same group even if their terminals are not connected by this relation);
  3. Create a directed graph whose nodes are the groups. For each pair ?? of terminals do: place an edge from the group of gb to the group of fa if , otherwise if place an edge from the group of fa to that of gb;
  4. If the constructed graph has a cycle then no precedence functions exist. When there are no cycles, let ?? be the length of the longest path from the group of fa and let ?? be the length of the longest path from the group of ga.

Example

[edit]

Consider the following table (repeated from above):[10]

Using the algorithm leads to the following graph:

    gid
      \
 fid   f*
    \  /
     g*
    /
  f+  
   | \
   |  g+
   |  |
  g$  f$

from which we extract the following precedence functions from the maximum heights in the directed acyclic graph:

id + * $
f 4 2 4 0
g 5 1 3 0

Operator-precedence languages

[edit]

The class of languages described by operator-precedence grammars, i.e., operator-precedence languages, is strictly contained in the class of deterministic context-free languages, and strictly contains visibly pushdown languages.[11]

Operator-precedence languages enjoy many closure properties: union, intersection, complementation,[12] concatenation,[11] and they are the largest known class closed under all these operations and for which the emptiness problem is decidable. Another peculiar feature of operator-precedence languages is their local parsability,[13] that enables efficient parallel parsing.

There are also characterizations based on an equivalent form of automata and monadic second-order logic.[14]

Notes

[edit]

References

[edit]
  • Aho, Alfred V.; Sethi, Ravi; Ullman, Jeffrey D. (1988). Compilers — Principles, Techniques, and Tools. Addison-Wesley.
  • Crespi Reghizzi, Stefano; Mandrioli, Dino (2012). "Operator precedence and the visibly pushdown property". Journal of Computer and System Sciences. 78 (6): 1837–1867. doi:10.1016/j.jcss.2011.12.006.
  • Crespi Reghizzi, Stefano; Mandrioli, Dino; Martin, David F. (1978). "Algebraic Properties of Operator Precedence Languages". Information and Control. 37 (2): 115–133. doi:10.1016/S0019-9958(78)90474-6.
  • Barenghi, Alessandro; Crespi Reghizzi, Stefano; Mandrioli, Dino; Panella, Federica; Pradella, Matteo (2015). "Parallel parsing made practical". Science of Computer Programming. 112 (3): 245–249. doi:10.1016/j.scico.2015.09.002. hdl:11311/971391.
  • Lonati, Violetta; Mandrioli, Dino; Panella, Federica; Pradella, Matteo (2015). "Operator Precedence Languages: Their Automata-Theoretic and Logic Characterization". SIAM Journal on Computing. 44 (4): 1026–1088. doi:10.1137/140978818. hdl:2434/352809.

Further reading

[edit]
[edit]
sch是什么意思 甲亢病是一种什么病 男人怕冷是什么原因 尿频是什么病 女人梦到被蛇咬是什么意思
玮字五行属什么 上传下达什么意思 立夏吃什么蛋 不悔梦归处只恨太匆匆是什么意思 夏至吃什么好
粉皮是什么做的 什么是腕管综合征 办护照需要什么 爱出者爱返福往者福来什么意思 眼睛有眼屎用什么眼药水
为什么第一次进不去 梦见买房子是什么预兆 麝香保心丸治什么病 脑梗吃什么水果好 全麦面包是什么意思
黄瓜籽粉有什么作用hcv7jop9ns9r.cn 5.2号是什么星座hcv8jop7ns6r.cn 山什么水什么hcv8jop1ns7r.cn 5岁属什么生肖qingzhougame.com 种草莓什么意思qingzhougame.com
汤力水是什么hcv8jop9ns3r.cn 阴囊潮湿是什么症状hcv8jop5ns6r.cn 咽炎挂什么科hcv8jop7ns7r.cn 男生眉毛浓黑代表什么hcv8jop4ns0r.cn 拔掉智齿有什么影响hcv7jop7ns3r.cn
pro是什么氨基酸hcv7jop6ns0r.cn 发物是什么意思hcv7jop5ns0r.cn 什么私语xjhesheng.com 调和油是什么油hcv7jop4ns8r.cn 钙片什么时候吃最好hcv8jop4ns8r.cn
八字缺什么怎么算hcv8jop0ns3r.cn 口炎是什么字hcv7jop7ns0r.cn 头皮痒用什么药最有效hcv8jop7ns1r.cn 为什么手淫很快就射hcv8jop3ns4r.cn 钥字五行属什么hcv8jop5ns8r.cn
百度