Professional Documents
Culture Documents
Exp 4 (Pass1 MacroProc) A 13 Kaustubh Desale
Exp 4 (Pass1 MacroProc) A 13 Kaustubh Desale
Experiment No.
04
Task: Write a program to read a given text file which can identify
the macros in the program and display MNT, MDT and
Argument List Array.
Student Name Kaustubh Desale
Roll No. 13
End For
End Procedure
def process_macros(file_path):
macro_name_table = {}
macro_definition_table = {}
argument_list_array = {}
# Display MNT
print("\nMacro Name Table (MNT):")
print(macro_name_table)
# Display MDT
print("\nMacro Definition Table (MDT):")
print(macro_definition_table)
# Example usage:
file_path = 'assembly_code.txt' # Specify the path to the assembly code
file
process_macros(file_path)
macro_INCR_definition.txt
macro_INCR_name.txt
Output of the
program:
Outcome of the To extract macro names, definitions, and input parameters from an
Experiment: assembly program using Python, you can leverage the `re` module for
handling regular expressions. The script will read the assembly file,
identify macro definitions, and then print and save the macro names and
definitions in a tabular format. Each macro name and its corresponding
definition will be stored in separate files using the `open` function.
Furthermore, the script will manage the extraction of input parameters
for each macro, ensuring comprehensive handling of the macro
components.
References: https://elearn.dbit.in/course/view.php?id=162