3
1

Made minor changes in pass 1 code and moved it to it's own folder since it also has a source file.

This commit is contained in:
K 2024-10-14 11:18:20 +05:30
parent ebebe4b0cb
commit 06b12bac85
Signed by: notkshitij
GPG Key ID: C5B8BC7530F8F43F
2 changed files with 5 additions and 6 deletions

View File

@ -1,11 +1,12 @@
#Original Code, Engineered by Afan Shaikh. no AI.
# Assignment-A1
try:
source = open('source.txt','r')
data = source.read()
print('File read successfully bro \n\n')
print('File read successfully\n\n')
source.seek(0)
except FileNotFoundError: #A little bit of exception handling
print('\n\n\nFile Not found. Create a source.txt first! u dummy!\n\n\n ')
print('\n\n\nFile Not found. Create a source.txt first.\n\n\n ')
except IOError:
print('There was an IO error')
LT_index = 0 #index of LT table
@ -42,8 +43,6 @@ def handle_start():
print("No Start Statement! Abort!\n")
return 0
def pass1():
add=handle_start()
if not add:
@ -107,4 +106,4 @@ def intermediate():
print(entry)
pass1()
intermediate()
intermediate()