Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Convert it to c + + code that can e run in SIC machine, and please give me an input . . . and explain

Convert it to c++ code that can e run in SIC machine, and please give me an input ...and explain line by line the code afteer convert Pass 1:
begin
read first input' line
if OPCODE = 'START' then
begin
save [OPERAND] as starting address
initialize LOCCTR to starting address
write line to intermediate file
read next input line
and (if START)
elae
initialize LOCCTR to 0
while OPCODE x' END ' do
begin
If this is not a comment line then
begin
1f there is a symbol in the LABEL field then
begin
search SYNTAB for LABEL
11 found then
set error flag (duplicate symbol)
elae
insert (LABEL, LOCCTR) into SYMTAB
end (if symbol)
search OPTAB for OPCODE
11 found then
add 3(instruction length) to LOCCTR
else if OPCODE = 'WORD' then
add 3 to LOCCTR
else if OPCODE = 'RESW' then
add 3*[OPERAND] to LOCCTR
else if OPCODE = 'RESB' then
add "[OPERAND] to LOCCTR
else if OPCODE = 'BYTE' then
begin
find length of constant in bytes
add length to LOCCTR
end (if BYTE)
ol se
set error flag (invalid operation code)
end (if not a comment)
write line to intermediate file
read next input 1 ine
end (while not END)
write last line to intermediate file
save (LOCCTR - starting address) as program length
and {Pass 1}
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Strategic Database Technology Management For The Year 2000

Authors: Alan Simon

1st Edition

155860264X, 978-1558602649

More Books

Students also viewed these Databases questions

Question

What is the use of bootstrap program?

Answered: 1 week ago

Question

What is a process and process table?

Answered: 1 week ago

Question

What is Industrial Economics and Theory of Firm?

Answered: 1 week ago

Question

Persuasive Speaking Organizing Patterns in Persuasive Speaking?

Answered: 1 week ago