Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

中间代码生成优先级错误 #1

Open
1330571 opened this issue Dec 29, 2020 · 0 comments
Open

中间代码生成优先级错误 #1

1330571 opened this issue Dec 29, 2020 · 0 comments

Comments

@1330571
Copy link

1330571 commented Dec 29, 2020

通过程序翻译出来的中间代码
(106) T1 := v * v
(107) T2 := u / T1
(108) T3 := u - T2
应该是
(106) T1 := u / v
(107) T2 := T1 * v
(108) T3 := u - T2
源代码是
int gcd (int u, int v)
{
if (v == 0) return u ;
else return gcd(v,u-u/vv);
}
翻译的时候u-u/v
v被翻译成了u/(v*v) ,没有处理优先级。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant