Can compilers detect infinite looping condition? [duplicate]

别来无恙 提交于 2019-12-13 18:41:23

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/17333862/can-compilers-detect-infinite-looping-condition

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!