我该如何解决这个问题?请给我一个提示 [英] How do I go about this problem? A hint would be nice, please

查看:65
本文介绍了我该如何解决这个问题?请给我一个提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编写一个函数,该函数接收用Java或C ++编写的函数,并构造接收函数的控制流图(具有最小或减少的节点数)。该函数必须至少处理以下任何嵌套深度的语句和特性:



1.Assignment语句和算术语句

2。简单的逻辑表达式和两个条件(或布尔值)的复合逻辑表达式。逻辑语句可能显示为条件(对于If,While和For),或者在逻辑表达式中。

3.如果那时和If if else语句

4 。声明

6.读写语句(你可以假设每种读写语句只有一种类型)

7.评论声明



我尝试了什么:



没试过多少,我的编码现在已经很低了。

Write a function that receives a function written in Java or C++ and constructs a control flow graph (with a minimum or reduced number of nodes) of the received function. The function must handle at least the following statements and features with any depth of nesting:

1.Assignment statement and arithmetic statement
2. Simple logical expression and composite logical expression of two conditions (or Boolean values). A logical statement may appear as a condition (for If, While, and For), or in a logical expression.
3. If then and If then else statements
4. While statement
6. Read and Write statements( you may assume only one type of each read and write statements)
7. Comment statement

What I have tried:

Have not tried much, my coding is quite subpar right now.

推荐答案

Quote:

编写一个函数,接收用Java编写的函数或C ++

Write a function that receives a function written in Java or C++

我的理解是你必须编写一个编译器来编译用Java或C ++编写的函数的源代码。编译器必须生成分析树(控制流图)。

What I understand is that you have to write a compiler that compile the source code of a function written in Java or C++. The compiler must produce an analyze tree (control flow graph).


这篇关于我该如何解决这个问题?请给我一个提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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