-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClaims.txt
135 lines (110 loc) · 4.45 KB
/
Claims.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/*****************************************************************************
TITLE: Claims
AUTHOR: Manshi Prajapati (2302CS08)
Declaration of Authorship
This txt file, claims.txt, is part of the assignment of CS2102 at the
department of Computer Science and Engg, IIT Patna .
*****************************************************************************/
Files:
==========
*All the files I submitted, asm.cpp and claims.txt, have my name and student id at the start, along with a declaration of authorship.
The evidence for Assembler including the output files from the four test examples given (test01 to test04) and bubbleSort has also been uploaded. They are test01(3 output files), test02(1 output file), test03(3 output files),
test04(3 output files) and bubbleSort(3 output files) and two additional test (with output files). All the test files have been tested.
Compilation instructions:
=========================
g++ asm.cpp
./a.exe
* Input file named “input.txt” must be present in the same folder where the code is executed
* Ouput files -> logfile.log and if there are no errors then machineCode.o file and listfile.lst file
Assumptions:
============
* Mnemonic named “data” is always used at the end of assembly code.
* Listing file (.lst) and Object file(.o) are generated only when there are no errors in the input Assembly code,
otherwise only Error file (.log) is generated.
=============================
Program format and structure:
=============================
1. The assembler:
* Every instruction is implemented.
* It contains a table of instruction names and expected operands.
* It is a 2 pass assembler (implemented in asm.cpp)
* outputs the required correct information in the form of three files
* .log file for errors and warnings
* .lst file for listing
* .o file for machine code object
* All important errors are diagnosed and corresponding error file gets generated (named logfile.log)
* consistent and sensible formatting with sensible program structure.
* sensible variable, function & type names with explanatory comments.
* Advanced listing file gets generated. (named listfile.lst)
* assembles test programs (including bubble sort)
* Machine code object file gets generated (named machineCode.o)
* SET instruction is also implemented (which carries extra marks).
* Code is written in C++ with optimum time and space complexity.
* Additional tests with outputs is also included
=============================
Testing:
=============================
1. The assembler:
I have tested five examples(4 test files and bubblesort) shown as bellow. The errors only occurred in the file test02.asm and the program immediately stopped on the second pass.
The others were tested without any errors detected and produced three output files, listing file,
error log file and machine readable object file, for each example.
1)
#Input: test1.asm
#Output:
a. listfile.lst
b. logfile.log (without any error messages)
c. machineCode.o
2)
#Input: test02.asm
#Output:
a. logfile.log (with error messages shown as below and also in log file)
error messages:
Line: 4 ERROR: Duplicate label definition
Line: 5 ERROR: no such label
Line: 6 ERROR: Invalid format: not a valid label or a number
Line: 7 ERROR: Missing operand
Line: 8 ERROR: unexpected operand
Line: 9 ERROR: extra on end of line
Line: 10 ERROR: Bogus Label name
Line: 11 ERROR: Bogus Mnemonic
Line: 12 ERROR: Bogus Mnemonic
3)
#Input:asm test03.asm
#Output:
a. listfile.lst
b. logfile.log (without any error messages)
c. machineCode.o
4)
#Input: test04.asm
#Output:
a. listfile.lst
b. logfile.log (without any error messages)
c. machineCode.o
5)
#Input: bubbleSort.txt
#Output:
a. listfile.lst
b. logfile.log (without any error messages)
c. machineCode.o
Additional Tests:
=================
6)
#Input: TestCase1.txt
#Output:
a. logfile.log (with error messages shown as below and also in log file)
Errors:
Line number: 1 Error: Bogus Label name
Line number: 6 Error: Unexpected operand
Line number: 11 Error: Invalid mnemonic
7)
#Input: TestCase2.txt
#Output:
a. listfile.lst
b. logfile.log (without any error messages)
b. machineCode.o
8)
#Input: TestCase3.txt
#Output:
a. listfile.lst
b. logfile.log (without any error messages)
b. machineCode.o