野牛规格和优先顺序 [英] Bison specification and precedence order

查看:104
本文介绍了野牛规格和优先顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给出野牛规格:%right TOK_ADD TOK_MUL

Given Bison Specification: %right TOK_ADD TOK_MUL

我想知道TOK_ADD和TOK_MUL的优先顺序是什么.

I was wondering what would be the precedence order of TOK_ADD and TOK_MUL.

如果我有Bison规范

Also in case i had Bison specification

%left TOKMUL TOKADD
%left TOKDIV
%left TOKSUB

我想知道TOKMUL TOKADD TOKDIV的优先顺序是什么 和TOKSUB是

I was wondering what would the precedence order of TOKMUL TOKADD TOKDIV and TOKSUB be

推荐答案

野牛/yacc优先顺序从低到高-列出的第一行中的标记优先级最低,而最后一行中的标记优先级最高.同一行上的多个令牌(在您的情况下为TOKMULTOKADD)具有相同的优先级

bison/yacc precedence order is lowest to highest -- the tokens on the first line listed have the lowest precedence while those on the last have the highest. Multiple tokens on the same line (TOKMUL and TOKADD in your case) have the same precedence

这篇关于野牛规格和优先顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆