NEA angefangen

This commit is contained in:
2021-03-25 11:32:32 +01:00
parent bc0f6cc045
commit 6831fb32bf
2 changed files with 10 additions and 3 deletions

View File

@@ -39,4 +39,4 @@ if __name__ == "__main__":
if accepted:
print(f"Das Wort '{word}' gehört zur Sprache")
else:
print(f"Das Wort '{word}' gehört nicht zur Sprache")
print(f"Das Wort '{word}' gehört nicht zur Sprache")

View File

@@ -10,7 +10,14 @@ def scan_word(state, word):
word = word[1:] # Ersten Buchstaben vom Restwort abtrennen
# Übergangsfunktion
if state == 0:
if char in "0123456789":
return scan_word(0,word)
elif char == 0:
return scan_word(1,word)
if state == 1:
if char == 0:
return scan_word(2,word)
# Übergänge
# siehe nea_abacc.py für ein Beispiel
@@ -25,4 +32,4 @@ if __name__ == "__main__":
if accepted:
print(f"Das Wort '{word}' gehört zur Sprache")
else:
print(f"Das Wort '{word}' gehört nicht zur Sprache")
print(f"Das Wort '{word}' gehört nicht zur Sprache")