如何解析表达式x --- y?这是法律表达吗? [英] How is the expression x---y parsed? Is it a legal expression?

查看:194
本文介绍了如何解析表达式x --- y?这是法律表达吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何解析表达式 x --- y ?这是合法的表达式吗?

How is the expression x---y parsed? Is it a legal expression?

推荐答案

它是合法的并且解析为 x - - y

It's legal and parsed as x-- - y.

两个减号被解释为减少后的运算符,因为它是在 x 后面出现的最长的符号。这使得第三减去起减法的作用。
这符合最大规则 [1]

I believe the first two minus signs are interpreted as a post-decrement operator because it's the longest token following x that is legal to appear. This leaves the third minus to play the role of subtraction. This is in accordance with the Maximal Much Rule[1]

[1]。 http://en.wikipedia.org/wiki/Maximal_munch

这篇关于如何解析表达式x --- y?这是法律表达吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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