Skip to content
Snippets Groups Projects
Commit 2b4992ea authored by Tamazouzt AIT ELDJOUDI's avatar Tamazouzt AIT ELDJOUDI
Browse files

added "annotated_to_string" function

parent 2bc43de6
Branches
No related tags found
No related merge requests found
...@@ -320,3 +320,24 @@ def annotate_beta_reduction(terme): ...@@ -320,3 +320,24 @@ def annotate_beta_reduction(terme):
return new_app(A1,annotate_beta_reduction(B1)) return new_app(A1,annotate_beta_reduction(B1))
if A2 == None and B2 == None: if A2 == None and B2 == None:
return None return None
def annotated_to_string(terme):
String_term=''
if len(terme)==5:
first=getFirstTerm(terme)
second=getSecondTerm(terme)
String_term+="(#"+str(terme[4])+to_string(getInputFromAbs(first))+"."+annotated_to_string(getOutputFromAbs(first))+') '
String_term+='('+ annotated_to_string(second)+ ')'
else:
if isApplication(terme):
first=getFirstTerm(terme)
second=getSecondTerm(terme)
String_term+= annotated_to_string(first)
String_term+=annotated_to_string(second)
elif isAbstraction(terme):
String_term+='#'+ to_string(getInputFromAbs(terme))+ '.' +annotated_to_string(getOutputFromAbs(terme))
else:
String_term+=to_string(terme)
return String_term
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment