考虑下面的属性文法G(S):产 生 式语 义 规 则S ® ABC print A.num, B.num, C.num A ® http://img2.ph.126.net/mwU_yZTj1MfxE1RqnNsI7A==/6608555265120376937.png aA.num = http://img2.ph.126.net/mwU_yZTj1MfxE1RqnNsI7A==/6608555265120376937.png.num + 1A ® εA.num = 0B ® http://img2.ph.126.net/7BsnFVEhNPQ29IMS0nrM1g==/6608926900050365519.png bB.num = http://img2.ph.126.net/7BsnFVEhNPQ29IMS0nrM1g==/6608926900050365519.png.num + 1B ® εB.num = 0C ® http://img0.ph.126.net/wLsxxOa5kEtJg4TcvKgDfA==/1615666366419475461.png cC.num = http://img0.ph.126.net/wLsxxOa5kEtJg4TcvKgDfA==/1615666366419475461.png.num + 1C ® εC.num = 0对于输入字符串aabbbc进行语法分析和属性计算,输出结果是
举一反三
- 考虑下面的属性文法G(S):产 生 式语 义 规 则S ® ABC print A.num, B.num, C.num A ® [img=20x22]18035825cebcda4.png[/img] aA.num = [img=20x22]18035825cebcda4.png[/img].num + 1A ® εA.num = 0B ® [img=20x22]18035825e1973dc.png[/img] bB.num = [img=20x22]18035825e1973dc.png[/img].num + 1B ® εB.num = 0C ® [img=20x22]18035825f2dc704.png[/img] cC.num = [img=20x22]18035825f2dc704.png[/img].num + 1C ® εC.num = 0对于输入字符串aabbbc进行语法分析和属性计算,输出结果是 A: 1 2 3 B: 3 2 1 C: 2 3 1 D: 2 1 3
- 考虑下面的属性文法G(S):产 生 式语 义 规 则S ® ABC print A.num, B.num, C.num A ® [img=20x22]1803d731db39d57.png[/img] aA.num = [img=20x22]1803d731db39d57.png[/img].num + 1A ® εA.num = 0B ® [img=20x22]1803d731ec91e62.png[/img] bB.num = [img=20x22]1803d731ec91e62.png[/img].num + 1B ® εB.num = 0C ® [img=20x22]1803d731fcad3f0.png[/img] cC.num = [img=20x22]1803d731fcad3f0.png[/img].num + 1C ® εC.num = 0对于输入字符串aabbbc进行语法分析和属性计算,输出结果是 A: 1 2 3 B: 3 2 1 C: 2 3 1 D: 2 1 3
- 考虑下面的属性文法G(S):产 生 式语 义 规 则S ® ABCprint A.num, B.num, C.num A ® [img=20x22]1803d73211b24cd.png[/img] aA.num = [img=20x22]1803d73211b24cd.png[/img].num + 1A ® εA.num = 0B ®[img=20x22]1803d7322247642.png[/img]bB.num = [img=20x22]1803d7322247642.png[/img].num + 1B ® εB.num = 0C ®[img=20x22]1803d7323424a77.png[/img] cC.num = [img=20x22]1803d7323424a77.png[/img].num + 1C ® εC.num = 0对于输入字符串aabbbc进行语法分析和属性计算,输出结果是 A: 1 2 3 B: 3 2 1 C: 2 3 1 D: 2 1 3
- 下列程序的输出结果是() num = 27 count = 0 while num > 0: if num % 2 == 0: num /=2 elif num % 3 ==0: num /= 3 else: num -=1 count += 1 print (count)
- 执行如下代码片段后,num的值为:int num = 5;num = (num % 2) == 0 ? num – 1 : num + 1; A: 1 B: 4 C: 5 D: 6