编译器可以检测无限循环条件吗? [英] Can compilers detect infinite looping condition?

查看:220
本文介绍了编译器可以检测无限循环条件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个自定义语言的编译器。编译器是否可以检测任何无限循环条件而不运行程序?

I'm building a compiler for a custom language. Is it possible for the compiler to detect any infinite looping condition without running the program?

如果是这样,我该如何实现呢?

If so how can I implement it?

推荐答案

你可以检测一些无限循环,但一般来说你不能检测所有可能的无限循环定制语言是专门用于消除一般循环结构的)。请参见 http://en.wikipedia.org/wiki/Halting_problem

You may be able to detect some infinite loops, but in general you can't detect all possible infinite loops (unless your custom language is specifically designed to eliminate general looping constructs). See http://en.wikipedia.org/wiki/Halting_problem.

这篇关于编译器可以检测无限循环条件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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