Browse Source

Generated MvK passes MvK tests

Yentl Van Tendeloo 7 years ago
parent
commit
3223df5cee

+ 82 - 81
kernel/modelverse_kernel/generated.py

@@ -52,51 +52,6 @@ class ModelverseKernel(object):
 		for i in range(len(keys)):
 		for i in range(len(keys)):
 			self.primitives[bodies[i]] = getattr(primitive_functions, function_names[i])
 			self.primitives[bodies[i]] = getattr(primitive_functions, function_names[i])
 
 
-	def execute_primitive(self, task_root, inst, taskname):
-		# execute_primitive
-		task_frame, =	yield [('RD', [task_root, 'frame'])]
-		symbols, =	   yield [('RD', [task_frame, 'symbols'])]
-		all_links, =	 yield [('RO', [symbols])]
-		containers =	yield [('RE', [v]) for v in all_links]
-		outgoings =	 yield [('RO', [v]) for v in all_links]
-		dict_values =   yield [('RD', [v[1], 'value']) for v in containers]
-		formals_1 =	 yield [('RE', [v[0]]) for v in outgoings]
-		dict_keys_ref = yield [('RD', [v[1], 'name']) for v in formals_1]
-		dict_keys =	 yield [('RV', [v]) for v in dict_keys_ref]
-		parameters = dict(zip(dict_keys, dict_values))
-
-		parameters['root'] = self.root
-		parameters['task_root'] = task_root
-		parameters['taskname'] = taskname
-		parameters['mvk'] = self
-
-		# prim is a generator itself!
-		try:
-			# Forward the message we get to this generator
-			# Sometimes it might not even be a generator, in which case this should already be in the except block (i.e., for the Read Root operation)
-			prim = self.primitives[inst](**parameters)
-			inp = None
-			while 1:
-				inp = yield prim.send(inp)
-		except StopIteration:
-			# Execution has ended without return value, so we have no idea what to do
-			raise Exception('Primitive finished without returning a value!')
-		except primitive_functions.PrimitiveFinished as e:
-			# Execution has ended with a returnvalue, so read it out from the exception being thrown
-			result = e.result
-
-			#if result is None:
-			#	raise Exception('Primitive raised exception: value of None for operation %s with parameters %s' % (self.compiled[inst], str(parameters)))
-
-		# Clean up the current stack, as if a return happened
-		old_frame, =	yield [('RD', [task_frame, 'prev'])]
-		lnk, =		  yield [('RDE', [old_frame, 'returnvalue'])]
-		_, _, _, _ =	yield [('CD', [old_frame, 'returnvalue', result]),
-							   ('CD', [task_root, 'frame', old_frame]),
-							   ('DE', [lnk]),
-							   ('DN', [task_frame]),
-							  ]
-
 	########################################
 	########################################
 	### Execute input and output methods ###
 	### Execute input and output methods ###
 	########################################
 	########################################
@@ -419,7 +374,7 @@ class ModelverseKernel(object):
 		if (False):
 		if (False):
 			# here to make code generation nicer...
 			# here to make code generation nicer...
 			pass
 			pass
-		elif (True  and Rules_N1_1 is not None  and Rules_N1_2 is not None  and Rules_N1_3 is not None  and Rules_N1_3_V['value'] == 'access' and Rules_N1_4 is not None  and Rules_N1_4_V == 'eval'):
+		elif (True  and Rules_N1_1 is not None  and Rules_N1_2 is not None  and Rules_N1_3 is not None  and isinstance(Rules_N1_3_V , dict) and Rules_N1_3_V['value'] == 'access' and Rules_N1_4 is not None  and Rules_N1_4_V == 'eval'):
 			# Execute rule Rules/Access_Eval_N1
 			# Execute rule Rules/Access_Eval_N1
 			print('Execute rule Rules/Access_Eval_N1')
 			print('Execute rule Rules/Access_Eval_N1')
 			Rules_N1_1, = yield [('RD', [Rules_N1_0, taskname])]
 			Rules_N1_1, = yield [('RD', [Rules_N1_0, taskname])]
@@ -436,7 +391,7 @@ class ModelverseKernel(object):
 			Rules___16, = yield [('CD', [Rules_N1_2, 'phase', Rules_N1_5])]
 			Rules___16, = yield [('CD', [Rules_N1_2, 'phase', Rules_N1_5])]
 			Rules___18, = yield [('CD', [Rules_N1_2, 'returnvalue', Rules_N1_6])]
 			Rules___18, = yield [('CD', [Rules_N1_2, 'returnvalue', Rules_N1_6])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N2_1 is not None  and Rules_N2_2 is not None  and Rules_N2_3 is not None  and Rules_N2_3_V == 'init' and Rules_N2_5 is not None  and Rules_N2_5_V['value'] == 'access'):
+		elif (True  and Rules_N2_1 is not None  and Rules_N2_2 is not None  and Rules_N2_3 is not None  and Rules_N2_3_V == 'init' and Rules_N2_5 is not None  and isinstance(Rules_N2_5_V , dict) and Rules_N2_5_V['value'] == 'access'):
 			# Execute rule Rules/Access_Init_N2
 			# Execute rule Rules/Access_Init_N2
 			print('Execute rule Rules/Access_Init_N2')
 			print('Execute rule Rules/Access_Init_N2')
 			Rules_N2_1, = yield [('RD', [Rules_N2_0, taskname])]
 			Rules_N2_1, = yield [('RD', [Rules_N2_0, taskname])]
@@ -457,7 +412,7 @@ class ModelverseKernel(object):
 			Rules___49, = yield [('CD', [Rules_N2_6, 'phase', Rules_N2_8])]
 			Rules___49, = yield [('CD', [Rules_N2_6, 'phase', Rules_N2_8])]
 			Rules___51, = yield [('CD', [Rules_N2_6, 'inst', Rules_N2_5])]
 			Rules___51, = yield [('CD', [Rules_N2_6, 'inst', Rules_N2_5])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N3_1 is not None  and Rules_N3_2 is not None  and Rules_N3_3 is not None  and Rules_N3_3_V['value'] == 'assign' and Rules_N3_4 is not None  and Rules_N3_4_V == 'assign'):
+		elif (True  and Rules_N3_1 is not None  and Rules_N3_2 is not None  and Rules_N3_3 is not None  and isinstance(Rules_N3_3_V , dict) and Rules_N3_3_V['value'] == 'assign' and Rules_N3_4 is not None  and Rules_N3_4_V == 'assign'):
 			# Execute rule Rules/Assign_Assign_N3
 			# Execute rule Rules/Assign_Assign_N3
 			print('Execute rule Rules/Assign_Assign_N3')
 			print('Execute rule Rules/Assign_Assign_N3')
 			Rules_N3_1, = yield [('RD', [Rules_N3_0, taskname])]
 			Rules_N3_1, = yield [('RD', [Rules_N3_0, taskname])]
@@ -477,7 +432,7 @@ class ModelverseKernel(object):
 			Rules___72, = yield [('CD', [Rules_N3_2, 'phase', Rules_N3_5])]
 			Rules___72, = yield [('CD', [Rules_N3_2, 'phase', Rules_N3_5])]
 			Rules___78, = yield [('CD', [Rules_N3_7, 'value', Rules_N3_6])]
 			Rules___78, = yield [('CD', [Rules_N3_7, 'value', Rules_N3_6])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N4_1 is not None  and Rules_N4_2 is not None  and Rules_N4_3 is not None  and Rules_N4_3_V == 'init' and Rules_N4_6 is not None  and Rules_N4_6_V['value'] == 'assign'):
+		elif (True  and Rules_N4_1 is not None  and Rules_N4_2 is not None  and Rules_N4_3 is not None  and Rules_N4_3_V == 'init' and Rules_N4_6 is not None  and isinstance(Rules_N4_6_V , dict) and Rules_N4_6_V['value'] == 'assign'):
 			# Execute rule Rules/Assign_Init_N4
 			# Execute rule Rules/Assign_Init_N4
 			print('Execute rule Rules/Assign_Init_N4')
 			print('Execute rule Rules/Assign_Init_N4')
 			Rules_N4_1, = yield [('RD', [Rules_N4_0, taskname])]
 			Rules_N4_1, = yield [('RD', [Rules_N4_0, taskname])]
@@ -498,7 +453,7 @@ class ModelverseKernel(object):
 			Rules___107, = yield [('CD', [Rules_N4_5, 'inst', Rules_N4_6])]
 			Rules___107, = yield [('CD', [Rules_N4_5, 'inst', Rules_N4_6])]
 			Rules___109, = yield [('CD', [Rules_N4_5, 'phase', Rules_N4_7])]
 			Rules___109, = yield [('CD', [Rules_N4_5, 'phase', Rules_N4_7])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N5_1 is not None  and Rules_N5_2 is not None  and Rules_N5_3 is not None  and Rules_N5_3_V == 'value' and Rules_N5_4 is not None  and Rules_N5_4_V['value'] == 'assign'):
+		elif (True  and Rules_N5_1 is not None  and Rules_N5_2 is not None  and Rules_N5_3 is not None  and Rules_N5_3_V == 'value' and Rules_N5_4 is not None  and isinstance(Rules_N5_4_V , dict) and Rules_N5_4_V['value'] == 'assign'):
 			# Execute rule Rules/Assign_Value_N5
 			# Execute rule Rules/Assign_Value_N5
 			print('Execute rule Rules/Assign_Value_N5')
 			print('Execute rule Rules/Assign_Value_N5')
 			Rules_N5_1, = yield [('RD', [Rules_N5_0, taskname])]
 			Rules_N5_1, = yield [('RD', [Rules_N5_0, taskname])]
@@ -525,7 +480,7 @@ class ModelverseKernel(object):
 			Rules___146, = yield [('CD', [Rules_N5_9, 'inst', Rules_N5_4])]
 			Rules___146, = yield [('CD', [Rules_N5_9, 'inst', Rules_N5_4])]
 			Rules___148, = yield [('CD', [Rules_N5_9, 'phase', Rules_N5_10])]
 			Rules___148, = yield [('CD', [Rules_N5_9, 'phase', Rules_N5_10])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N6_1 is not None  and Rules_N6_2 is not None  and Rules_N6_3 is not None  and Rules_N6_3_V == 'init' and Rules_N6_5 is not None  and Rules_N6_5_V['value'] == 'break'):
+		elif (True  and Rules_N6_1 is not None  and Rules_N6_2 is not None  and Rules_N6_3 is not None  and Rules_N6_3_V == 'init' and Rules_N6_5 is not None  and isinstance(Rules_N6_5_V , dict) and Rules_N6_5_V['value'] == 'break'):
 			# Execute rule Rules/Break_N6
 			# Execute rule Rules/Break_N6
 			print('Execute rule Rules/Break_N6')
 			print('Execute rule Rules/Break_N6')
 			Rules_N6_1, = yield [('RD', [Rules_N6_0, taskname])]
 			Rules_N6_1, = yield [('RD', [Rules_N6_0, taskname])]
@@ -554,7 +509,7 @@ class ModelverseKernel(object):
 			Rules___185, = yield [('CD', [Rules_N6_9, 'prev', Rules_N6_8])]
 			Rules___185, = yield [('CD', [Rules_N6_9, 'prev', Rules_N6_8])]
 			Rules___187, = yield [('CD', [Rules_N6_8, 'phase', Rules_N6_11])]
 			Rules___187, = yield [('CD', [Rules_N6_8, 'phase', Rules_N6_11])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N7_1 is not None  and Rules_N7_3 is not None  and Rules_N7_6 is not None  and Rules_N7_6_V['value'] == 'call' and Rules_N7_10 is not None  and Rules_N7_10_V == 'call' and Rules_N7_11 is None ):
+		elif (True  and Rules_N7_1 is not None  and Rules_N7_3 is not None  and Rules_N7_6 is not None  and isinstance(Rules_N7_6_V , dict) and Rules_N7_6_V['value'] == 'call' and Rules_N7_10 is not None  and Rules_N7_10_V == 'call' and Rules_N7_11 is None ):
 			# Execute rule Rules/Call_Call_None_N7
 			# Execute rule Rules/Call_Call_None_N7
 			print('Execute rule Rules/Call_Call_None_N7')
 			print('Execute rule Rules/Call_Call_None_N7')
 			Rules_N7_1, = yield [('RD', [Rules_N7_0, taskname])]
 			Rules_N7_1, = yield [('RD', [Rules_N7_0, taskname])]
@@ -584,7 +539,7 @@ class ModelverseKernel(object):
 			Rules___223, = yield [('CD', [Rules_N7_2, 'prev', Rules_N7_3])]
 			Rules___223, = yield [('CD', [Rules_N7_2, 'prev', Rules_N7_3])]
 			Rules___229, = yield [('CD', [Rules_N7_3, 'phase', Rules_N7_9])]
 			Rules___229, = yield [('CD', [Rules_N7_3, 'phase', Rules_N7_9])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N8_1 is not None  and Rules_N8_3 is not None  and Rules_N8_4 is not None  and Rules_N8_4_V['value'] == 'call' and Rules_N8_5 is not None  and Rules_N8_14 is not None  and Rules_N8_14_V == 'call'):
+		elif (True  and Rules_N8_1 is not None  and Rules_N8_3 is not None  and Rules_N8_4 is not None  and isinstance(Rules_N8_4_V , dict) and Rules_N8_4_V['value'] == 'call' and Rules_N8_5 is not None  and Rules_N8_14 is not None  and Rules_N8_14_V == 'call'):
 			# Execute rule Rules/Call_Call_Params_N8
 			# Execute rule Rules/Call_Call_Params_N8
 			print('Execute rule Rules/Call_Call_Params_N8')
 			print('Execute rule Rules/Call_Call_Params_N8')
 			Rules_N8_1, = yield [('RD', [Rules_N8_0, taskname])]
 			Rules_N8_1, = yield [('RD', [Rules_N8_0, taskname])]
@@ -630,7 +585,7 @@ class ModelverseKernel(object):
 			Rules_N8_16, = yield [('CE', [Rules_N8_15, Rules_N8_10])]
 			Rules_N8_16, = yield [('CE', [Rules_N8_15, Rules_N8_10])]
 			Rules___286, = yield [('CE', [Rules_N8_16, Rules_N8_9])]
 			Rules___286, = yield [('CE', [Rules_N8_16, Rules_N8_9])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N9_1 is not None  and Rules_N9_2 is not None  and Rules_N9_14 is not None  and Rules_N9_14_V['value'] == 'call' and Rules_N9_15 is not None  and Rules_N9_16 is not None ):
+		elif (True  and Rules_N9_1 is not None  and Rules_N9_2 is not None  and Rules_N9_14 is not None  and isinstance(Rules_N9_14_V , dict) and Rules_N9_14_V['value'] == 'call' and Rules_N9_15 is not None  and Rules_N9_16 is not None ):
 			# Execute rule Rules/Call_Params_First_Multi_N9
 			# Execute rule Rules/Call_Params_First_Multi_N9
 			print('Execute rule Rules/Call_Params_First_Multi_N9')
 			print('Execute rule Rules/Call_Params_First_Multi_N9')
 			Rules_N9_1, = yield [('RD', [Rules_N9_0, taskname])]
 			Rules_N9_1, = yield [('RD', [Rules_N9_0, taskname])]
@@ -671,7 +626,7 @@ class ModelverseKernel(object):
 			Rules___344, = yield [('CD', [Rules_N9_13, 'inst', Rules_N9_14])]
 			Rules___344, = yield [('CD', [Rules_N9_13, 'inst', Rules_N9_14])]
 			Rules___346, = yield [('CD', [Rules_N9_13, 'phase', Rules_N9_16])]
 			Rules___346, = yield [('CD', [Rules_N9_13, 'phase', Rules_N9_16])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N10_1 is not None  and Rules_N10_2 is not None  and Rules_N10_14 is not None  and Rules_N10_14_V['value'] == 'call' and Rules_N10_15 is not None ):
+		elif (True  and Rules_N10_1 is not None  and Rules_N10_2 is not None  and Rules_N10_14 is not None  and isinstance(Rules_N10_14_V , dict) and Rules_N10_14_V['value'] == 'call' and Rules_N10_15 is not None ):
 			# Execute rule Rules/Call_Params_First_Single_N10
 			# Execute rule Rules/Call_Params_First_Single_N10
 			print('Execute rule Rules/Call_Params_First_Single_N10')
 			print('Execute rule Rules/Call_Params_First_Single_N10')
 			Rules_N10_1, = yield [('RD', [Rules_N10_0, taskname])]
 			Rules_N10_1, = yield [('RD', [Rules_N10_0, taskname])]
@@ -713,7 +668,7 @@ class ModelverseKernel(object):
 			Rules___410, = yield [('CD', [Rules_N10_12, 'inst', Rules_N10_14])]
 			Rules___410, = yield [('CD', [Rules_N10_12, 'inst', Rules_N10_14])]
 			Rules___418, = yield [('CD', [Rules_N10_17, 'prev', Rules_N10_12])]
 			Rules___418, = yield [('CD', [Rules_N10_17, 'prev', Rules_N10_12])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N11_1 is not None  and Rules_N11_2 is not None  and Rules_N11_14 is not None  and Rules_N11_16 is not None  and Rules_N11_16_V['value'] == 'call'):
+		elif (True  and Rules_N11_1 is not None  and Rules_N11_2 is not None  and Rules_N11_14 is not None  and Rules_N11_16 is not None  and isinstance(Rules_N11_16_V , dict) and Rules_N11_16_V['value'] == 'call'):
 			# Execute rule Rules/Call_Params_Last_N11
 			# Execute rule Rules/Call_Params_Last_N11
 			print('Execute rule Rules/Call_Params_Last_N11')
 			print('Execute rule Rules/Call_Params_Last_N11')
 			Rules_N11_1, = yield [('RD', [Rules_N11_0, taskname])]
 			Rules_N11_1, = yield [('RD', [Rules_N11_0, taskname])]
@@ -776,7 +731,7 @@ class ModelverseKernel(object):
 			Rules_N11_8, = yield [('CE', [Rules_N11_20, Rules_N11_9])]
 			Rules_N11_8, = yield [('CE', [Rules_N11_20, Rules_N11_9])]
 			Rules___489, = yield [('CE', [Rules_N11_8, Rules_N11_7])]
 			Rules___489, = yield [('CE', [Rules_N11_8, Rules_N11_7])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N12_1 is not None  and Rules_N12_2 is not None  and Rules_N12_11 is not None  and Rules_N12_18 is not None  and Rules_N12_19 is not None  and Rules_N12_19_V['value'] == 'call'):
+		elif (True  and Rules_N12_1 is not None  and Rules_N12_2 is not None  and Rules_N12_11 is not None  and Rules_N12_18 is not None  and Rules_N12_19 is not None  and isinstance(Rules_N12_19_V , dict) and Rules_N12_19_V['value'] == 'call'):
 			# Execute rule Rules/Call_Params_Next_N12
 			# Execute rule Rules/Call_Params_Next_N12
 			print('Execute rule Rules/Call_Params_Next_N12')
 			print('Execute rule Rules/Call_Params_Next_N12')
 			Rules_N12_1, = yield [('RD', [Rules_N12_0, taskname])]
 			Rules_N12_1, = yield [('RD', [Rules_N12_0, taskname])]
@@ -838,7 +793,7 @@ class ModelverseKernel(object):
 			Rules_N12_8, = yield [('CE', [Rules_N12_13, Rules_N12_9])]
 			Rules_N12_8, = yield [('CE', [Rules_N12_13, Rules_N12_9])]
 			Rules___560, = yield [('CE', [Rules_N12_8, Rules_N12_7])]
 			Rules___560, = yield [('CE', [Rules_N12_8, Rules_N12_7])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N13_1 is not None  and Rules_N13_2 is not None  and Rules_N13_3 is not None  and Rules_N13_3_V == 'init' and Rules_N13_6 is not None  and Rules_N13_6_V['value'] == 'call' and Rules_N13_9 is None ):
+		elif (True  and Rules_N13_1 is not None  and Rules_N13_2 is not None  and Rules_N13_3 is not None  and Rules_N13_3_V == 'init' and Rules_N13_6 is not None  and isinstance(Rules_N13_6_V , dict) and Rules_N13_6_V['value'] == 'call' and Rules_N13_9 is None ):
 			# Execute rule Rules/Call_Resolve_No_Params_N13
 			# Execute rule Rules/Call_Resolve_No_Params_N13
 			print('Execute rule Rules/Call_Resolve_No_Params_N13')
 			print('Execute rule Rules/Call_Resolve_No_Params_N13')
 			Rules_N13_1, = yield [('RD', [Rules_N13_0, taskname])]
 			Rules_N13_1, = yield [('RD', [Rules_N13_0, taskname])]
@@ -860,7 +815,7 @@ class ModelverseKernel(object):
 			Rules___588, = yield [('CD', [Rules_N13_5, 'inst', Rules_N13_6])]
 			Rules___588, = yield [('CD', [Rules_N13_5, 'inst', Rules_N13_6])]
 			Rules___590, = yield [('CD', [Rules_N13_5, 'phase', Rules_N13_7])]
 			Rules___590, = yield [('CD', [Rules_N13_5, 'phase', Rules_N13_7])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N14_1 is not None  and Rules_N14_2 is not None  and Rules_N14_5 is not None  and Rules_N14_5_V['value'] == 'call' and Rules_N14_7 is not None  and Rules_N14_7_V == 'init' and Rules_N14_8 is not None ):
+		elif (True  and Rules_N14_1 is not None  and Rules_N14_2 is not None  and Rules_N14_5 is not None  and isinstance(Rules_N14_5_V , dict) and Rules_N14_5_V['value'] == 'call' and Rules_N14_7 is not None  and Rules_N14_7_V == 'init' and Rules_N14_8 is not None ):
 			# Execute rule Rules/Call_Resolve_Params_N14
 			# Execute rule Rules/Call_Resolve_Params_N14
 			print('Execute rule Rules/Call_Resolve_Params_N14')
 			print('Execute rule Rules/Call_Resolve_Params_N14')
 			Rules_N14_1, = yield [('RD', [Rules_N14_0, taskname])]
 			Rules_N14_1, = yield [('RD', [Rules_N14_0, taskname])]
@@ -881,7 +836,7 @@ class ModelverseKernel(object):
 			Rules___621, = yield [('CD', [Rules_N14_3, 'inst', Rules_N14_5])]
 			Rules___621, = yield [('CD', [Rules_N14_3, 'inst', Rules_N14_5])]
 			Rules___623, = yield [('CD', [Rules_N14_4, 'prev', Rules_N14_3])]
 			Rules___623, = yield [('CD', [Rules_N14_4, 'prev', Rules_N14_3])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N15_1 is not None  and Rules_N15_2 is not None  and Rules_N15_4 is not None  and Rules_N15_4_V == 'init' and Rules_N15_6 is not None  and Rules_N15_6_V['value'] == 'constant'):
+		elif (True  and Rules_N15_1 is not None  and Rules_N15_2 is not None  and Rules_N15_4 is not None  and Rules_N15_4_V == 'init' and Rules_N15_6 is not None  and isinstance(Rules_N15_6_V , dict) and Rules_N15_6_V['value'] == 'constant'):
 			# Execute rule Rules/Const_N15
 			# Execute rule Rules/Const_N15
 			print('Execute rule Rules/Const_N15')
 			print('Execute rule Rules/Const_N15')
 			Rules_N15_1, = yield [('RD', [Rules_N15_0, taskname])]
 			Rules_N15_1, = yield [('RD', [Rules_N15_0, taskname])]
@@ -898,7 +853,7 @@ class ModelverseKernel(object):
 			Rules___641, = yield [('CD', [Rules_N15_2, 'returnvalue', Rules_N15_7])]
 			Rules___641, = yield [('CD', [Rules_N15_2, 'returnvalue', Rules_N15_7])]
 			Rules___647, = yield [('CD', [Rules_N15_2, 'phase', Rules_N15_5])]
 			Rules___647, = yield [('CD', [Rules_N15_2, 'phase', Rules_N15_5])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N16_1 is not None  and Rules_N16_2 is not None  and Rules_N16_3 is not None  and Rules_N16_3_V == 'init' and Rules_N16_4 is not None  and Rules_N16_4_V['value'] == 'continue'):
+		elif (True  and Rules_N16_1 is not None  and Rules_N16_2 is not None  and Rules_N16_3 is not None  and Rules_N16_3_V == 'init' and Rules_N16_4 is not None  and isinstance(Rules_N16_4_V , dict) and Rules_N16_4_V['value'] == 'continue'):
 			# Execute rule Rules/Continue_N16
 			# Execute rule Rules/Continue_N16
 			print('Execute rule Rules/Continue_N16')
 			print('Execute rule Rules/Continue_N16')
 			Rules_N16_1, = yield [('RD', [Rules_N16_0, taskname])]
 			Rules_N16_1, = yield [('RD', [Rules_N16_0, taskname])]
@@ -925,7 +880,7 @@ class ModelverseKernel(object):
 			Rules___682, = yield [('CD', [Rules_N16_2, 'evalstack', Rules_N16_8])]
 			Rules___682, = yield [('CD', [Rules_N16_2, 'evalstack', Rules_N16_8])]
 			Rules___684, = yield [('CD', [Rules_N16_8, 'prev', Rules_N16_7])]
 			Rules___684, = yield [('CD', [Rules_N16_8, 'prev', Rules_N16_7])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N17_1 is not None  and Rules_N17_2 is not None  and Rules_N17_3 is not None  and Rules_N17_3_V == 'init' and Rules_N17_5 is not None  and Rules_N17_5_V['value'] == 'declare'):
+		elif (True  and Rules_N17_1 is not None  and Rules_N17_2 is not None  and Rules_N17_3 is not None  and Rules_N17_3_V == 'init' and Rules_N17_5 is not None  and isinstance(Rules_N17_5_V , dict) and Rules_N17_5_V['value'] == 'declare'):
 			# Execute rule Rules/Declare_Init_N17
 			# Execute rule Rules/Declare_Init_N17
 			print('Execute rule Rules/Declare_Init_N17')
 			print('Execute rule Rules/Declare_Init_N17')
 			Rules_N17_1, = yield [('RD', [Rules_N17_0, taskname])]
 			Rules_N17_1, = yield [('RD', [Rules_N17_0, taskname])]
@@ -942,7 +897,7 @@ class ModelverseKernel(object):
 			Rules_N17_9, = yield [('CE', [Rules_N17_6, Rules_N17_8])]
 			Rules_N17_9, = yield [('CE', [Rules_N17_6, Rules_N17_8])]
 			Rules___710, = yield [('CE', [Rules_N17_9, Rules_N17_7])]
 			Rules___710, = yield [('CE', [Rules_N17_9, Rules_N17_7])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N18_1 is not None  and Rules_N18_2 is not None  and Rules_N18_4 is not None  and Rules_N18_4_V == 'init' and Rules_N18_6 is not None  and Rules_N18_6_V['value'] == 'global'):
+		elif (True  and Rules_N18_1 is not None  and Rules_N18_2 is not None  and Rules_N18_4 is not None  and Rules_N18_4_V == 'init' and Rules_N18_6 is not None  and isinstance(Rules_N18_6_V , dict) and Rules_N18_6_V['value'] == 'global'):
 			# Execute rule Rules/Global_Init_N18
 			# Execute rule Rules/Global_Init_N18
 			print('Execute rule Rules/Global_Init_N18')
 			print('Execute rule Rules/Global_Init_N18')
 			Rules_N18_1, = yield [('RD', [Rules_N18_0, taskname])]
 			Rules_N18_1, = yield [('RD', [Rules_N18_0, taskname])]
@@ -959,7 +914,7 @@ class ModelverseKernel(object):
 			Rules_N18_9, = yield [('CE', [Rules_N18_3, Rules_N18_8])]
 			Rules_N18_9, = yield [('CE', [Rules_N18_3, Rules_N18_8])]
 			Rules___736, = yield [('CE', [Rules_N18_9, Rules_N18_7])]
 			Rules___736, = yield [('CE', [Rules_N18_9, Rules_N18_7])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N19_1 is not None  and Rules_N19_2 is not None  and Rules_N19_3 is not None  and Rules_N19_3_V == 'init' and Rules_N19_6 is not None  and Rules_N19_6_V['value'] == 'if'):
+		elif (True  and Rules_N19_1 is not None  and Rules_N19_2 is not None  and Rules_N19_3 is not None  and Rules_N19_3_V == 'init' and Rules_N19_6 is not None  and isinstance(Rules_N19_6_V , dict) and Rules_N19_6_V['value'] == 'if'):
 			# Execute rule Rules/If_Cond_N19
 			# Execute rule Rules/If_Cond_N19
 			print('Execute rule Rules/If_Cond_N19')
 			print('Execute rule Rules/If_Cond_N19')
 			Rules_N19_1, = yield [('RD', [Rules_N19_0, taskname])]
 			Rules_N19_1, = yield [('RD', [Rules_N19_0, taskname])]
@@ -980,7 +935,7 @@ class ModelverseKernel(object):
 			Rules___763, = yield [('CD', [Rules_N19_5, 'inst', Rules_N19_6])]
 			Rules___763, = yield [('CD', [Rules_N19_5, 'inst', Rules_N19_6])]
 			Rules___765, = yield [('CD', [Rules_N19_5, 'phase', Rules_N19_7])]
 			Rules___765, = yield [('CD', [Rules_N19_5, 'phase', Rules_N19_7])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N20_1 is not None  and Rules_N20_2 is not None  and Rules_N20_3 is not None  and Rules_N20_3_V == 'cond' and Rules_N20_4 is not None  and Rules_N20_4_V['value'] == 'if' and Rules_N20_6 is not None  and Rules_N20_6_V == False and Rules_N20_8 is not None ):
+		elif (True  and Rules_N20_1 is not None  and Rules_N20_2 is not None  and Rules_N20_3 is not None  and Rules_N20_3_V == 'cond' and Rules_N20_4 is not None  and isinstance(Rules_N20_4_V , dict) and Rules_N20_4_V['value'] == 'if' and Rules_N20_6 is not None  and Rules_N20_6_V == False and Rules_N20_8 is not None ):
 			# Execute rule Rules/If_False_Else_N20
 			# Execute rule Rules/If_False_Else_N20
 			print('Execute rule Rules/If_False_Else_N20')
 			print('Execute rule Rules/If_False_Else_N20')
 			Rules_N20_1, = yield [('RD', [Rules_N20_0, taskname])]
 			Rules_N20_1, = yield [('RD', [Rules_N20_0, taskname])]
@@ -1006,7 +961,7 @@ class ModelverseKernel(object):
 			Rules___802, = yield [('CD', [Rules_N20_9, 'inst', Rules_N20_4])]
 			Rules___802, = yield [('CD', [Rules_N20_9, 'inst', Rules_N20_4])]
 			Rules___804, = yield [('CD', [Rules_N20_9, 'phase', Rules_N20_10])]
 			Rules___804, = yield [('CD', [Rules_N20_9, 'phase', Rules_N20_10])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N21_1 is not None  and Rules_N21_2 is not None  and Rules_N21_3 is not None  and Rules_N21_3_V == 'cond' and Rules_N21_5 is not None  and Rules_N21_5_V['value'] == 'if' and Rules_N21_6 is not None  and Rules_N21_6_V == False and Rules_N21_7 is None ):
+		elif (True  and Rules_N21_1 is not None  and Rules_N21_2 is not None  and Rules_N21_3 is not None  and Rules_N21_3_V == 'cond' and Rules_N21_5 is not None  and isinstance(Rules_N21_5_V , dict) and Rules_N21_5_V['value'] == 'if' and Rules_N21_6 is not None  and Rules_N21_6_V == False and Rules_N21_7 is None ):
 			# Execute rule Rules/If_False_None_N21
 			# Execute rule Rules/If_False_None_N21
 			print('Execute rule Rules/If_False_None_N21')
 			print('Execute rule Rules/If_False_None_N21')
 			Rules_N21_1, = yield [('RD', [Rules_N21_0, taskname])]
 			Rules_N21_1, = yield [('RD', [Rules_N21_0, taskname])]
@@ -1020,7 +975,7 @@ class ModelverseKernel(object):
 			Rules_N21_4, = yield [('CNV', ['finish'])]
 			Rules_N21_4, = yield [('CNV', ['finish'])]
 			Rules___824, = yield [('CD', [Rules_N21_2, 'phase', Rules_N21_4])]
 			Rules___824, = yield [('CD', [Rules_N21_2, 'phase', Rules_N21_4])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N22_1 is not None  and Rules_N22_2 is not None  and Rules_N22_3 is not None  and Rules_N22_3_V == 'cond' and Rules_N22_6 is not None  and Rules_N22_6_V == True and Rules_N22_9 is not None  and Rules_N22_9_V['value'] == 'if'):
+		elif (True  and Rules_N22_1 is not None  and Rules_N22_2 is not None  and Rules_N22_3 is not None  and Rules_N22_3_V == 'cond' and Rules_N22_6 is not None  and Rules_N22_6_V == True and Rules_N22_9 is not None  and isinstance(Rules_N22_9_V , dict) and Rules_N22_9_V['value'] == 'if'):
 			# Execute rule Rules/If_True_N22
 			# Execute rule Rules/If_True_N22
 			print('Execute rule Rules/If_True_N22')
 			print('Execute rule Rules/If_True_N22')
 			Rules_N22_1, = yield [('RD', [Rules_N22_0, taskname])]
 			Rules_N22_1, = yield [('RD', [Rules_N22_0, taskname])]
@@ -1046,7 +1001,7 @@ class ModelverseKernel(object):
 			Rules___859, = yield [('CD', [Rules_N22_7, 'inst', Rules_N22_9])]
 			Rules___859, = yield [('CD', [Rules_N22_7, 'inst', Rules_N22_9])]
 			Rules___861, = yield [('CD', [Rules_N22_7, 'phase', Rules_N22_10])]
 			Rules___861, = yield [('CD', [Rules_N22_7, 'phase', Rules_N22_10])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N23_1 is not None  and Rules_N23_2 is not None  and Rules_N23_5 is not None  and Rules_N23_5_V['value'] == 'input' and Rules_N23_6 is not None  and Rules_N23_6_V == 'init' and Rules_N23_7 is not None  and Rules_N23_8 is not None ):
+		elif (True  and Rules_N23_1 is not None  and Rules_N23_2 is not None  and Rules_N23_5 is not None  and isinstance(Rules_N23_5_V , dict) and Rules_N23_5_V['value'] == 'input' and Rules_N23_6 is not None  and Rules_N23_6_V == 'init' and Rules_N23_7 is not None  and Rules_N23_8 is not None ):
 			# Execute rule Rules/Input_N23
 			# Execute rule Rules/Input_N23
 			print('Execute rule Rules/Input_N23')
 			print('Execute rule Rules/Input_N23')
 			Rules_N23_1, = yield [('RD', [Rules_N23_0, taskname])]
 			Rules_N23_1, = yield [('RD', [Rules_N23_0, taskname])]
@@ -1116,7 +1071,7 @@ class ModelverseKernel(object):
 			Rules___940, = yield [('CD', [Rules_N25_2, 'evalstack', Rules_N25_7])]
 			Rules___940, = yield [('CD', [Rules_N25_2, 'evalstack', Rules_N25_7])]
 			Rules___942, = yield [('CD', [Rules_N25_2, 'phase', Rules_N25_8])]
 			Rules___942, = yield [('CD', [Rules_N25_2, 'phase', Rules_N25_8])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N26_1 is not None  and Rules_N26_2 is not None  and Rules_N26_3 is not None  and Rules_N26_3_V == 'init' and Rules_N26_4 is not None  and Rules_N26_4_V['value'] == 'output'):
+		elif (True  and Rules_N26_1 is not None  and Rules_N26_2 is not None  and Rules_N26_3 is not None  and Rules_N26_3_V == 'init' and Rules_N26_4 is not None  and isinstance(Rules_N26_4_V , dict) and Rules_N26_4_V['value'] == 'output'):
 			# Execute rule Rules/Output_Init_N26
 			# Execute rule Rules/Output_Init_N26
 			print('Execute rule Rules/Output_Init_N26')
 			print('Execute rule Rules/Output_Init_N26')
 			Rules_N26_1, = yield [('RD', [Rules_N26_0, taskname])]
 			Rules_N26_1, = yield [('RD', [Rules_N26_0, taskname])]
@@ -1137,7 +1092,7 @@ class ModelverseKernel(object):
 			Rules___977, = yield [('CD', [Rules_N26_6, 'inst', Rules_N26_4])]
 			Rules___977, = yield [('CD', [Rules_N26_6, 'inst', Rules_N26_4])]
 			Rules___979, = yield [('CD', [Rules_N26_6, 'phase', Rules_N26_8])]
 			Rules___979, = yield [('CD', [Rules_N26_6, 'phase', Rules_N26_8])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N27_1 is not None  and Rules_N27_2 is not None  and Rules_N27_4 is not None  and Rules_N27_4_V['value'] == 'output' and Rules_N27_5 is not None  and Rules_N27_5_V == 'output'):
+		elif (True  and Rules_N27_1 is not None  and Rules_N27_2 is not None  and Rules_N27_4 is not None  and isinstance(Rules_N27_4_V , dict) and Rules_N27_4_V['value'] == 'output' and Rules_N27_5 is not None  and Rules_N27_5_V == 'output'):
 			# Execute rule Rules/Output_Output_N27
 			# Execute rule Rules/Output_Output_N27
 			print('Execute rule Rules/Output_Output_N27')
 			print('Execute rule Rules/Output_Output_N27')
 			Rules_N27_1, = yield [('RD', [Rules_N27_0, taskname])]
 			Rules_N27_1, = yield [('RD', [Rules_N27_0, taskname])]
@@ -1157,7 +1112,7 @@ class ModelverseKernel(object):
 			Rules___1006, = yield [('CD', [Rules_N27_3, 'next', Rules_N27_8])]
 			Rules___1006, = yield [('CD', [Rules_N27_3, 'next', Rules_N27_8])]
 			Rules___1008, = yield [('CD', [Rules_N27_1, 'last_output', Rules_N27_8])]
 			Rules___1008, = yield [('CD', [Rules_N27_1, 'last_output', Rules_N27_8])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N28_1 is not None  and Rules_N28_3 is not None  and Rules_N28_5 is not None  and Rules_N28_7 is not None  and Rules_N28_7_V['value'] == 'resolve' and Rules_N28_8 is not None  and Rules_N28_8_V == 'init' and Rules_N28_10 is not None  and Rules_N28_11 is None ):
+		elif (True  and Rules_N28_1 is not None  and Rules_N28_3 is not None  and Rules_N28_5 is not None  and Rules_N28_7 is not None  and isinstance(Rules_N28_7_V , dict) and Rules_N28_7_V['value'] == 'resolve' and Rules_N28_8 is not None  and Rules_N28_8_V == 'init' and Rules_N28_10 is not None  and Rules_N28_11 is None ):
 			# Execute rule Rules/Resolve_NoAttrGlobal_N28
 			# Execute rule Rules/Resolve_NoAttrGlobal_N28
 			print('Execute rule Rules/Resolve_NoAttrGlobal_N28')
 			print('Execute rule Rules/Resolve_NoAttrGlobal_N28')
 			Rules_N28_1, = yield [('RD', [Rules_N28_0, taskname])]
 			Rules_N28_1, = yield [('RD', [Rules_N28_0, taskname])]
@@ -1178,7 +1133,7 @@ class ModelverseKernel(object):
 			Rules___1030, = yield [('CD', [Rules_N28_3, 'phase', Rules_N28_4])]
 			Rules___1030, = yield [('CD', [Rules_N28_3, 'phase', Rules_N28_4])]
 			Rules___1040, = yield [('CD', [Rules_N28_3, 'returnvalue', Rules_N28_9])]
 			Rules___1040, = yield [('CD', [Rules_N28_3, 'returnvalue', Rules_N28_9])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N29_1 is not None  and Rules_N29_2 is not None  and Rules_N29_3 is not None  and Rules_N29_3_V['value'] == 'resolve' and Rules_N29_4 is not None  and Rules_N29_4_V == 'init' and Rules_N29_6 is not None  and Rules_N29_7 is not None  and Rules_N29_9 is not None ):
+		elif (True  and Rules_N29_1 is not None  and Rules_N29_2 is not None  and Rules_N29_3 is not None  and isinstance(Rules_N29_3_V , dict) and Rules_N29_3_V['value'] == 'resolve' and Rules_N29_4 is not None  and Rules_N29_4_V == 'init' and Rules_N29_6 is not None  and Rules_N29_7 is not None  and Rules_N29_9 is not None ):
 			# Execute rule Rules/Resolve_NoAttr_N29
 			# Execute rule Rules/Resolve_NoAttr_N29
 			print('Execute rule Rules/Resolve_NoAttr_N29')
 			print('Execute rule Rules/Resolve_NoAttr_N29')
 			Rules_N29_1, = yield [('RD', [Rules_N29_0, taskname])]
 			Rules_N29_1, = yield [('RD', [Rules_N29_0, taskname])]
@@ -1197,7 +1152,7 @@ class ModelverseKernel(object):
 			Rules___1068, = yield [('CD', [Rules_N29_2, 'phase', Rules_N29_5])]
 			Rules___1068, = yield [('CD', [Rules_N29_2, 'phase', Rules_N29_5])]
 			Rules___1072, = yield [('CD', [Rules_N29_2, 'returnvalue', Rules_N29_7])]
 			Rules___1072, = yield [('CD', [Rules_N29_2, 'returnvalue', Rules_N29_7])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N30_1 is not None  and Rules_N30_2 is not None  and Rules_N30_4 is not None  and Rules_N30_4_V == 'eval' and Rules_N30_5 is not None  and Rules_N30_5_V['value'] == 'return'):
+		elif (True  and Rules_N30_1 is not None  and Rules_N30_2 is not None  and Rules_N30_4 is not None  and Rules_N30_4_V == 'eval' and Rules_N30_5 is not None  and isinstance(Rules_N30_5_V , dict) and Rules_N30_5_V['value'] == 'return'):
 			# Execute rule Rules/Return_Eval_N30
 			# Execute rule Rules/Return_Eval_N30
 			print('Execute rule Rules/Return_Eval_N30')
 			print('Execute rule Rules/Return_Eval_N30')
 			Rules_N30_1, = yield [('RD', [Rules_N30_0, taskname])]
 			Rules_N30_1, = yield [('RD', [Rules_N30_0, taskname])]
@@ -1222,7 +1177,7 @@ class ModelverseKernel(object):
 			Rules___1093, = yield [('CD', [Rules_N30_1, 'frame', Rules_N30_3])]
 			Rules___1093, = yield [('CD', [Rules_N30_1, 'frame', Rules_N30_3])]
 			Rules___1103, = yield [('CD', [Rules_N30_3, 'returnvalue', Rules_N30_6])]
 			Rules___1103, = yield [('CD', [Rules_N30_3, 'returnvalue', Rules_N30_6])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N31_1 is not None  and Rules_N31_2 is not None  and Rules_N31_4 is not None  and Rules_N31_4_V == 'init' and Rules_N31_5 is not None  and Rules_N31_5_V['value'] == 'return' and Rules_N31_6 is None ):
+		elif (True  and Rules_N31_1 is not None  and Rules_N31_2 is not None  and Rules_N31_4 is not None  and Rules_N31_4_V == 'init' and Rules_N31_5 is not None  and isinstance(Rules_N31_5_V , dict) and Rules_N31_5_V['value'] == 'return' and Rules_N31_6 is None ):
 			# Execute rule Rules/Return_NoValue_N31
 			# Execute rule Rules/Return_NoValue_N31
 			print('Execute rule Rules/Return_NoValue_N31')
 			print('Execute rule Rules/Return_NoValue_N31')
 			Rules_N31_1, = yield [('RD', [Rules_N31_0, taskname])]
 			Rules_N31_1, = yield [('RD', [Rules_N31_0, taskname])]
@@ -1241,7 +1196,7 @@ class ModelverseKernel(object):
 			Rules_N31_6, = yield [('RD', [Rules_N31_5, 'value'])]
 			Rules_N31_6, = yield [('RD', [Rules_N31_5, 'value'])]
 			Rules___1118, = yield [('CD', [Rules_N31_1, 'frame', Rules_N31_3])]
 			Rules___1118, = yield [('CD', [Rules_N31_1, 'frame', Rules_N31_3])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N32_1 is not None  and Rules_N32_2 is not None  and Rules_N32_3 is not None  and Rules_N32_3_V == 'init' and Rules_N32_5 is not None  and Rules_N32_5_V['value'] == 'return' and Rules_N32_7 is not None ):
+		elif (True  and Rules_N32_1 is not None  and Rules_N32_2 is not None  and Rules_N32_3 is not None  and Rules_N32_3_V == 'init' and Rules_N32_5 is not None  and isinstance(Rules_N32_5_V , dict) and Rules_N32_5_V['value'] == 'return' and Rules_N32_7 is not None ):
 			# Execute rule Rules/Return_Value_N32
 			# Execute rule Rules/Return_Value_N32
 			print('Execute rule Rules/Return_Value_N32')
 			print('Execute rule Rules/Return_Value_N32')
 			Rules_N32_1, = yield [('RD', [Rules_N32_0, taskname])]
 			Rules_N32_1, = yield [('RD', [Rules_N32_0, taskname])]
@@ -1262,7 +1217,7 @@ class ModelverseKernel(object):
 			Rules___1153, = yield [('CD', [Rules_N32_6, 'inst', Rules_N32_5])]
 			Rules___1153, = yield [('CD', [Rules_N32_6, 'inst', Rules_N32_5])]
 			Rules___1155, = yield [('CD', [Rules_N32_6, 'phase', Rules_N32_8])]
 			Rules___1155, = yield [('CD', [Rules_N32_6, 'phase', Rules_N32_8])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N33_1 is not None  and Rules_N33_2 is not None  and Rules_N33_3 is not None  and Rules_N33_3_V == 'init' and Rules_N33_5 is not None  and Rules_N33_5_V['value'] == 'while'):
+		elif (True  and Rules_N33_1 is not None  and Rules_N33_2 is not None  and Rules_N33_3 is not None  and Rules_N33_3_V == 'init' and Rules_N33_5 is not None  and isinstance(Rules_N33_5_V , dict) and Rules_N33_5_V['value'] == 'while'):
 			# Execute rule Rules/While_Cond_N33
 			# Execute rule Rules/While_Cond_N33
 			print('Execute rule Rules/While_Cond_N33')
 			print('Execute rule Rules/While_Cond_N33')
 			Rules_N33_1, = yield [('RD', [Rules_N33_0, taskname])]
 			Rules_N33_1, = yield [('RD', [Rules_N33_0, taskname])]
@@ -1283,7 +1238,7 @@ class ModelverseKernel(object):
 			Rules___1184, = yield [('CD', [Rules_N33_6, 'inst', Rules_N33_5])]
 			Rules___1184, = yield [('CD', [Rules_N33_6, 'inst', Rules_N33_5])]
 			Rules___1186, = yield [('CD', [Rules_N33_6, 'phase', Rules_N33_8])]
 			Rules___1186, = yield [('CD', [Rules_N33_6, 'phase', Rules_N33_8])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N34_1 is not None  and Rules_N34_2 is not None  and Rules_N34_3 is not None  and Rules_N34_3_V == 'cond' and Rules_N34_5 is not None  and Rules_N34_5_V['value'] == 'while' and Rules_N34_6 is not None  and Rules_N34_6_V == False):
+		elif (True  and Rules_N34_1 is not None  and Rules_N34_2 is not None  and Rules_N34_3 is not None  and Rules_N34_3_V == 'cond' and Rules_N34_5 is not None  and isinstance(Rules_N34_5_V , dict) and Rules_N34_5_V['value'] == 'while' and Rules_N34_6 is not None  and Rules_N34_6_V == False):
 			# Execute rule Rules/While_False_N34
 			# Execute rule Rules/While_False_N34
 			print('Execute rule Rules/While_False_N34')
 			print('Execute rule Rules/While_False_N34')
 			Rules_N34_1, = yield [('RD', [Rules_N34_0, taskname])]
 			Rules_N34_1, = yield [('RD', [Rules_N34_0, taskname])]
@@ -1296,7 +1251,7 @@ class ModelverseKernel(object):
 			Rules_N34_4, = yield [('CNV', ['finish'])]
 			Rules_N34_4, = yield [('CNV', ['finish'])]
 			Rules___1203, = yield [('CD', [Rules_N34_2, 'phase', Rules_N34_4])]
 			Rules___1203, = yield [('CD', [Rules_N34_2, 'phase', Rules_N34_4])]
 			print(str(locals()))
 			print(str(locals()))
-		elif (True  and Rules_N35_1 is not None  and Rules_N35_2 is not None  and Rules_N35_3 is not None  and Rules_N35_3_V == 'cond' and Rules_N35_5 is not None  and Rules_N35_5_V['value'] == 'while' and Rules_N35_7 is not None  and Rules_N35_7_V == True):
+		elif (True  and Rules_N35_1 is not None  and Rules_N35_2 is not None  and Rules_N35_3 is not None  and Rules_N35_3_V == 'cond' and Rules_N35_5 is not None  and isinstance(Rules_N35_5_V , dict) and Rules_N35_5_V['value'] == 'while' and Rules_N35_7 is not None  and Rules_N35_7_V == True):
 			# Execute rule Rules/While_True_N35
 			# Execute rule Rules/While_True_N35
 			print('Execute rule Rules/While_True_N35')
 			print('Execute rule Rules/While_True_N35')
 			Rules_N35_1, = yield [('RD', [Rules_N35_0, taskname])]
 			Rules_N35_1, = yield [('RD', [Rules_N35_0, taskname])]
@@ -1327,6 +1282,52 @@ class ModelverseKernel(object):
 			Rules___1249, = yield [('CD', [Rules_N35_6, 'prev', Rules_N35_8])]
 			Rules___1249, = yield [('CD', [Rules_N35_6, 'prev', Rules_N35_8])]
 			print(str(locals()))
 			print(str(locals()))
 		else:
 		else:
-			# no rules were applicable, so idle for some time
-			pass #TODO
-			raise Exception(str(locals()))
+			task_root, = yield [('RD', [root, taskname])]
+			task_frame, = yield [('RD', [task_root, 'frame'])]
+			task_IP, = yield [('RD', [task_frame, 'IP'])]
+			task_phase, = yield [('RD', [task_frame, 'phase'])]
+			task_phase, = yield [('RV', [task_phase])]
+			if (task_IP is not None and task_IP in self.primitives and task_phase == 'init'):
+				# Execute a primitive!
+				print('Executing primitive!')
+				symbols, =	   yield [('RD', [task_frame, 'symbols'])]
+				all_links, =	 yield [('RO', [symbols])]
+				containers =	yield [('RE', [v]) for v in all_links]
+				outgoings =	 yield [('RO', [v]) for v in all_links]
+				dict_values =   yield [('RD', [v[1], 'value']) for v in containers]
+				formals_1 =	 yield [('RE', [v[0]]) for v in outgoings]
+				dict_keys_ref = yield [('RD', [v[1], 'name']) for v in formals_1]
+				dict_keys =	 yield [('RV', [v]) for v in dict_keys_ref]
+				parameters = dict(zip(dict_keys, dict_values))
+				parameters['root'] = root
+				parameters['task_root'] = task_root
+				parameters['taskname'] = taskname
+				parameters['mvk'] = self
+				# prim is a generator itself!
+				try:
+					# Forward the message we get to this generator
+					# Sometimes it might not even be a generator, in which case this should already be in the except block (i.e., for the Read Root operation)
+					prim = self.primitives[task_IP](**parameters)
+					inp = None
+					while 1:
+						inp = yield prim.send(inp)
+				except StopIteration:
+					# Execution has ended without return value, so we have no idea what to do
+					raise Exception('Primitive finished without returning a value!')
+				except primitive_functions.PrimitiveFinished as e:
+					# Execution has ended with a returnvalue, so read it out from the exception being thrown
+					result = e.result
+					#if result is None:
+					#	raise Exception('Primitive raised exception: value of None for operation %s with parameters %s' % (self.compiled[task_IP], str(parameters)))
+				# Clean up the current stack, as if a return happened
+				old_frame, =	yield [('RD', [task_frame, 'prev'])]
+				lnk, =		  yield [('RDE', [old_frame, 'returnvalue'])]
+				_, _, _, _ =	yield [('CD', [old_frame, 'returnvalue', result]),
+									   ('CD', [task_root, 'frame', old_frame]),
+									   ('DE', [lnk]),
+									   ('DN', [task_frame]),
+									  ]
+
+			else:
+				# no rules were applicable, so idle for some time
+				pass #TODO

+ 50 - 49
kernel/rules/to_python.alc

@@ -80,51 +80,6 @@ Boolean function main(model : Element):
 	result = result + "        for i in range(len(keys)):\n"
 	result = result + "        for i in range(len(keys)):\n"
 	result = result + "            self.primitives[bodies[i]] = getattr(primitive_functions, function_names[i])\n"
 	result = result + "            self.primitives[bodies[i]] = getattr(primitive_functions, function_names[i])\n"
 	result = result + "\n"
 	result = result + "\n"
-	result = result + "    def execute_primitive(self, task_root, inst, taskname):\n"
-	result = result + "        # execute_primitive\n"
-	result = result + "        task_frame, =    yield [('RD', [task_root, 'frame'])]\n"
-	result = result + "        symbols, =       yield [('RD', [task_frame, 'symbols'])]\n"
-	result = result + "        all_links, =     yield [('RO', [symbols])]\n"
-	result = result + "        containers =    yield [('RE', [v]) for v in all_links]\n"
-	result = result + "        outgoings =     yield [('RO', [v]) for v in all_links]\n"
-	result = result + "        dict_values =   yield [('RD', [v[1], 'value']) for v in containers]\n"
-	result = result + "        formals_1 =     yield [('RE', [v[0]]) for v in outgoings]\n"
-	result = result + "        dict_keys_ref = yield [('RD', [v[1], 'name']) for v in formals_1]\n"
-	result = result + "        dict_keys =     yield [('RV', [v]) for v in dict_keys_ref]\n"
-	result = result + "        parameters = dict(zip(dict_keys, dict_values))\n"
-	result = result + "\n"
-	result = result + "        parameters['root'] = self.root\n"
-	result = result + "        parameters['task_root'] = task_root\n"
-	result = result + "        parameters['taskname'] = taskname\n"
-	result = result + "        parameters['mvk'] = self\n"
-	result = result + "\n"
-	result = result + "        # prim is a generator itself!\n"
-	result = result + "        try:\n"
-	result = result + "            # Forward the message we get to this generator\n"
-	result = result + "            # Sometimes it might not even be a generator, in which case this should already be in the except block (i.e., for the Read Root operation)\n"
-	result = result + "            prim = self.primitives[inst](**parameters)\n"
-	result = result + "            inp = None\n"
-	result = result + "            while 1:\n"
-	result = result + "                inp = yield prim.send(inp)\n"
-	result = result + "        except StopIteration:\n"
-	result = result + "            # Execution has ended without return value, so we have no idea what to do\n"
-	result = result + "            raise Exception('Primitive finished without returning a value!')\n"
-	result = result + "        except primitive_functions.PrimitiveFinished as e:\n"
-	result = result + "            # Execution has ended with a returnvalue, so read it out from the exception being thrown\n"
-	result = result + "            result = e.result\n"
-	result = result + "\n"
-	result = result + "            #if result is None:\n"
-	result = result + "            #    raise Exception('Primitive raised exception: value of None for operation %s with parameters %s' % (self.compiled[inst], str(parameters)))\n"
-	result = result + "\n"
-	result = result + "        # Clean up the current stack, as if a return happened\n"
-	result = result + "        old_frame, =    yield [('RD', [task_frame, 'prev'])]\n"
-	result = result + "        lnk, =          yield [('RDE', [old_frame, 'returnvalue'])]\n"
-	result = result + "        _, _, _, _ =    yield [('CD', [old_frame, 'returnvalue', result]),\n"
-	result = result + "                               ('CD', [task_root, 'frame', old_frame]),\n"
-	result = result + "                               ('DE', [lnk]),\n"
-	result = result + "                               ('DN', [task_frame]),\n"
-	result = result + "                              ]\n"
-	result = result + "\n"
 	result = result + "    ########################################\n"
 	result = result + "    ########################################\n"
 	result = result + "    ### Execute input and output methods ###\n"
 	result = result + "    ### Execute input and output methods ###\n"
 	result = result + "    ########################################\n"
 	result = result + "    ########################################\n"
@@ -256,7 +211,7 @@ Boolean function main(model : Element):
 						sign = "=="
 						sign = "=="
 
 
 					if (string_get(value, 0) == "!"):
 					if (string_get(value, 0) == "!"):
-						result = result + " and " + string_replace(node, "/", "_") + "_V['value'] " + sign + " '" + string_replace(value, "!", "") + "'"
+						result = result + " and isinstance(" + string_replace(node, "/", "_") + "_V , dict) and " + string_replace(node, "/", "_") + "_V['value'] " + sign + " '" + string_replace(value, "!", "") + "'"
 					else:
 					else:
 						result = result + " and " + string_replace(node, "/", "_") + "_V " + sign + " " + value
 						result = result + " and " + string_replace(node, "/", "_") + "_V " + sign + " " + value
 
 
@@ -415,9 +370,55 @@ Boolean function main(model : Element):
 		result = result + "            print(str(locals()))\n"
 		result = result + "            print(str(locals()))\n"
 
 
 	result = result + "        else:\n"
 	result = result + "        else:\n"
-	result = result + "            # no rules were applicable, so idle for some time\n"
-	result = result + "            pass #TODO\n"
-	result = result + "            raise Exception(str(locals()))\n"
+	result = result + "            task_root, = yield [('RD', [root, taskname])]\n"
+	result = result + "            task_frame, = yield [('RD', [task_root, 'frame'])]\n"
+	result = result + "            task_IP, = yield [('RD', [task_frame, 'IP'])]\n"
+	result = result + "            task_phase, = yield [('RD', [task_frame, 'phase'])]\n"
+	result = result + "            task_phase, = yield [('RV', [task_phase])]\n"
+	result = result + "            if (task_IP is not None and task_IP in self.primitives and task_phase == 'init'):\n"
+	result = result + "                # Execute a primitive!\n"
+	result = result + "                print('Executing primitive!')\n"
+	result = result + "                symbols, =       yield [('RD', [task_frame, 'symbols'])]\n"
+	result = result + "                all_links, =     yield [('RO', [symbols])]\n"
+	result = result + "                containers =    yield [('RE', [v]) for v in all_links]\n"
+	result = result + "                outgoings =     yield [('RO', [v]) for v in all_links]\n"
+	result = result + "                dict_values =   yield [('RD', [v[1], 'value']) for v in containers]\n"
+	result = result + "                formals_1 =     yield [('RE', [v[0]]) for v in outgoings]\n"
+	result = result + "                dict_keys_ref = yield [('RD', [v[1], 'name']) for v in formals_1]\n"
+	result = result + "                dict_keys =     yield [('RV', [v]) for v in dict_keys_ref]\n"
+	result = result + "                parameters = dict(zip(dict_keys, dict_values))\n"
+	result = result + "                parameters['root'] = root\n"
+	result = result + "                parameters['task_root'] = task_root\n"
+	result = result + "                parameters['taskname'] = taskname\n"
+	result = result + "                parameters['mvk'] = self\n"
+	result = result + "                # prim is a generator itself!\n"
+	result = result + "                try:\n"
+	result = result + "                    # Forward the message we get to this generator\n"
+	result = result + "                    # Sometimes it might not even be a generator, in which case this should already be in the except block (i.e., for the Read Root operation)\n"
+	result = result + "                    prim = self.primitives[task_IP](**parameters)\n"
+	result = result + "                    inp = None\n"
+	result = result + "                    while 1:\n"
+	result = result + "                        inp = yield prim.send(inp)\n"
+	result = result + "                except StopIteration:\n"
+	result = result + "                    # Execution has ended without return value, so we have no idea what to do\n"
+	result = result + "                    raise Exception('Primitive finished without returning a value!')\n"
+	result = result + "                except primitive_functions.PrimitiveFinished as e:\n"
+	result = result + "                    # Execution has ended with a returnvalue, so read it out from the exception being thrown\n"
+	result = result + "                    result = e.result\n"
+	result = result + "                    #if result is None:\n"
+	result = result + "                    #    raise Exception('Primitive raised exception: value of None for operation %s with parameters %s' % (self.compiled[task_IP], str(parameters)))\n"
+	result = result + "                # Clean up the current stack, as if a return happened\n"
+	result = result + "                old_frame, =    yield [('RD', [task_frame, 'prev'])]\n"
+	result = result + "                lnk, =          yield [('RDE', [old_frame, 'returnvalue'])]\n"
+	result = result + "                _, _, _, _ =    yield [('CD', [old_frame, 'returnvalue', result]),\n"
+	result = result + "                                       ('CD', [task_root, 'frame', old_frame]),\n"
+	result = result + "                                       ('DE', [lnk]),\n"
+	result = result + "                                       ('DN', [task_frame]),\n"
+	result = result + "                                      ]\n"
+	result = result + "\n"
+	result = result + "            else:\n"
+	result = result + "                # no rules were applicable, so idle for some time\n"
+	result = result + "                pass #TODO\n"
 
 
 	log("Got result:")
 	log("Got result:")
 	log(result)
 	log(result)

+ 0 - 28
kernel/test_generated/rules/test_rules_utility.py

@@ -1,28 +0,0 @@
-import unittest
-from modelverse_kernel.generated import ModelverseKernel
-
-class TestUtility(unittest.TestCase):
-    def test_overlap_normal(self):
-        c = ModelverseKernel(0).find_overlapping([1, 2, 3], [2, 4])
-        self.assertEquals(c, 2)
-
-    def test_overlap_none_empty(self):
-        try:
-            ModelverseKernel(0).find_overlapping([], [2, 4])
-            self.fail() # pragma: no cover
-        except:
-            pass
-
-    def test_overlap_none(self):
-        try:
-            ModelverseKernel(0).find_overlapping([1, 3], [2, 4, 5])
-            self.fail() # pragma: no cover
-        except:
-            pass
-
-    def test_overlap_multi(self):
-        try:
-            ModelverseKernel(0).find_overlapping([1, 2, 3], [2, 4, 1])
-            self.fail() # pragma: no cover
-        except:
-            pass

+ 1 - 1
wrappers/modelverse_SCCD.py

@@ -1,7 +1,7 @@
 """
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
 
-Date:   Tue Nov 28 08:33:05 2017
+Date:   Tue Nov 28 09:52:44 2017
 
 
 Model author: Yentl Van Tendeloo
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server
 Model name:   MvK Server