Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7860253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:12:40+00:00 2026-06-02T22:12:40+00:00

I am doing a project in which I have to create a translator that

  • 0

I am doing a project in which I have to create a translator that would generate a MIPS assembly code for a C code. The programming language that am using is C++ and I have done till generation of three address code and am really confused about how to proceed further.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T22:12:42+00:00Added an answer on June 2, 2026 at 10:12 pm

    As already stated, it’s a direct translation. There’s really nothing to clarify. As an example, take the following three-address code:

          i := 0                  ; assignment
    L1:   if i >= 10 goto L2      ; conditional jump
          t0 := i*i
          t1 := &b                ; address-of operation
          t2 := t1 + i            ; t2 holds the address of b[i]
          *t2 := t0               ; store through pointer
          i := i + 1
          goto L1
    L2:
    

    The MIPS translation is:

            li $t0, 0             #allocator assigned i to t0
    L1:     bge $t0, 10, L2    
            mult $t1, $t0, $t0  
            la $t2, b             
            add $t3, $t2, $t0   
            sw $t1, ($t3)       
            addi $t0, $t0, 1
            j L1
    L2:
    

    If your lucky enough to have three-address like that, you barely have to do anything. Find the corresponding opcode to go with the instruction. The register allocation has already been done. If the three-address code is literally a bunch a strings, I’d consider writing a small parser (using a generator) instead of trying to extract information from the strings.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I m doing a project using eclipse plugin to create a IDE. I have
I'm doing a project at uni and would like to create zip files which
i am doing a project in which i have to get the image from
I am doing a project in which i have to send a message at
The background to this problem is that I'm doing a computing project which involves
I'm working on project in which I have to create a search engine through
we're using Jenkins as our build server. We have a Project which is built
I have an existing Xcode (4.3) project which will automatically always create a local
I'm doing a project in Java which includes (x,y) coordinates. I have created a
I'm doing a java project in which I have to use a MySQL database

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.