简体   繁体   English

开发算法可视化/模拟

[英]developing an algorithm visualization/simulation

I would like to develop a visualization tool that able to read c programming syntax.我想开发一个能够阅读 c 编程语法的可视化工具。 The code will includes some functions call, timing information and some triggering mechanism.该代码将包括一些函数调用、计时信息和一些触发机制。 By recognizing all these syntax, I will be able to simulate and visualize those "functions calls".通过识别所有这些语法,我将能够模拟和可视化这些“函数调用”。 The program usually use to perform searching and sorting algorithm.该程序通常用于执行搜索和排序算法。

Some visualization tools such as python Bokeh could be use for visualization (can recommend if there are better tools).可以使用python Bokeh等一些可视化工具进行可视化(如果有更好的工具可以推荐)。 The question here is how can the c-syntax to be translated to language such as python, and each items/objects written in C code in the searching/sorting algorithm, can be represented as an visual kind of shape object.这里的问题是如何将c-syntax翻译成python等语言,搜索/排序算法中用C代码编写的每个项目/对象如何表示为视觉类型的形状对象。

Is anyone does anything similar?有没有人做类似的事情? appreciate if some suggestion on the tools used and the work flow or steps to realized this task.如果对所使用的工具和工作流程或实现此任务的步骤有一些建议,我们将不胜感激。 Thank you谢谢

If you want to do it well, you are looking for a C abstract syntax tree (AST) parser that runs under python.如果你想做得好,你正在寻找一个在python下运行的C抽象语法树(AST)解析器。

However as it seems you want to interactively run the code as well, an existing opensouce C interpreter might be a better starting point.但是,由于您似乎还想以交互方式运行代码,因此现有的 opensouce C 解释器可能是一个更好的起点。

This is just giving you some pointers for your own research.这只是为您自己的研究提供一些指导。 There are many existing C AST parsers and C interpreters.有许多现有的 C AST 解析器和 C 解释器。 Read a bit about them.阅读一些关于它们的信息。 The subject is not so simple that I could give one simple and clear answer however.然而,这个主题并不简单,我可以给出一个简单而明确的答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM