是否有随机的C ++程序生成器? [英] Is there a random C++ program generator?

查看:182
本文介绍了是否有随机的C ++程序生成器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找一个能够随机生成C ++程序的工具。我一直在使用 Csmith C程序生成器测试我正在开发的工具,但现在我想去进一步测试与随机生成的C ++代码。注意,我对现有的C ++测试套件不感兴趣(我已经使用了一些)。



任何帮助将非常感谢。提前致谢!

解决方案

这里是另一个建议,类似的程序(包括源代码),用于编译器开发。你可以参考它并开发类似的东西。 链接


随机C / C ++程序生成器




  • 创建一系列用于整个程序的随​​机类型

  • 创建主函数。

  • 生成随机的语句块,最大限度地控制&表达式嵌套深度。

  • 如果在#3中定义了新功能,则循环以填充它的正文。

  • 当达到最大数量的函数时,停止生成新功能并完成剩余功能的主体。

  • 输出生成的程序。


目标: p>


  • 查找编译器前端(崩溃等)中的基本错误

  • 解决优化中的正确性错误通过。

  • 支持工具设计以搜索改进的优化路径(部分执行等)


I am looking for a tool that is able to randomly generate C++ programs. I have been using the Csmith C program generator for testing a tool I am developing, but now I would like to go a step further and test with randomly generated C++ code. Note that I am not interested in existing C++ test suites (I already use some).

Any help will be greatly appreciated. Thanks in advance!

解决方案

Here's another suggestion for a similar program (with source included), which is being used for compiler development. You can probably refer to it and develop something similar. link

Random C/C++ Program Generator

  • Create a set of random types to be used throughout the program
  • Create the main func.
  • Generate a random block of statements with maximum control & expression nesting depths.
  • If new functions were defined in #3, then loop back to fill in it's body.
  • When a maximum number of functions is reached, stop generating new functions and finish off the bodies of the remaining funcs.
  • Output generated program.

GOALS:

  • Locate basic errors in compiler front-ends (crashes, etc)
  • Ferret out correctness errors in optimization passes.
  • Support the design of tools to search for improved optimization paths (partial execution, etc)

这篇关于是否有随机的C ++程序生成器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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