Suoritettu

Write C Program

Write a C program to take as input (via stdin) a valid assignment statement in C and generate

MIPS assembly code to perform the given calculation(s). You can assume that each C variable

name is one lowercase letter (e.g., a, b, c, etc.) and of type int. Further, positive int constants

are also allowed as part of the given expression. For this script, you only need to support the addition (+) and subtraction (-) operators.

Note that you should use isspace(), islower(), isdigit(), scanf(), etc. to parse the input.

The MIPS code you generate must make use of registers $s0,$s1,...,$s7 to correspond to C variables and registers $t0,$t1,...$t9 to correspond to any temporary variables you need. Variables in MIPS should match those in C from left to right, meaning that the final result of the script statement must end up in register $s0.

You can assume that you will not need more than the specific MIPS registers listed here.

Below are a few example runs of your program. In the first example, register $s0 corresponds to

C variable f, $s1 corresponds to g, and $s2 corresponds to h.

bash$ ./[login to view URL]

Please enter a valid C assignment statement:

f = g + h - 42;

The MIPS pseudocode is:

add $t0,$s1,$s2

sub $s0,$t0,42

bash$ ./[login to view URL]

Please enter a valid C assignment statement:

x = q - 12 + j;

The MIPS pseudocode is:

sub $t0,$s1,12

add $s0,$t0,$s2

bash$ ./[login to view URL]

Please enter a valid C assignment statement:

a = x - y + 13 + x - a;

The MIPS pseudocode is:

sub $t0,$s1,$s2

add $t1,$t0,13

add $t2,$t1,$s1

sub $s0,$t2,$s0

Taidot: Assembly, C-ohjelmointi, tietojärjestelmäarkkitehtuuri, x86/x64 Assembler

Näytä lisää: write program gauge expected cost item specific number yearsprogram outputs estimated cost item loop, write program evaluate postfix expression, c program of a small job for university, c programming basics, c programming examples with output, c programming software, c programming tutorial, basic c programs for beginners pdf, c programs with solutions, c programming questions, c programs list, need to write a program for, write a c program to accept 10 or more numbers then display the numbers in two columns one column with the numbers as they were , write a C program, write a c++ program to accept 10 or more numbers then: display the numbers in two columns: one column with the numbers as they w, write a program for three processors in the boss-worker, write a program for three processors in the bossworker, write a program to generate a optimal binary search tree for the given (ordered) keys and the number of times each key is search, write a program to generate a optimal binary search tree for the given ordered keys and the number of times each key is searched, write c program online

Tietoa työnantajasta:
( 2 arvostelua ) Seaford, United States

Projektin tunnus: #17905419

Myönnetty käyttäjälle:

asadrana91

Hi there this is Asad, if you are looking to get a good grade, contact me , would surely help you out.

$100 USD 1 päivässä
(43 Arvostelua)
5.8

3 freelanceria on tarjonnut keskimäärin %project_bid_stats_avg_sub_26% %project_currencyDetails_sign_sub_27% tähän työhön

iharobalasimi

I have experience in c programming, not so much in MIPS assembly but do have some in assembly. I have questions before starting. This is my SO [login to view URL] developer story. You can chec Lisää

$55 USD 1 päivässä
(1 arvostelu)
1.6
$111 USD 10 päivässä
(0 arvostelua)
0.0