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 6834879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:09:55+00:00 2026-05-26T23:09:55+00:00

After viewing lots of posts about the difference between compilers and interpreters, I’m still

  • 0

After viewing lots of posts about the difference between compilers and interpreters, I’m still not able to figure out the difference in their construction and internal mechanism.

The most common difference I read was that a compiler produces a target program which is executable { means machine code as its output } which can run on a system and than be fed with input.
Whereas an interpreter simply runs the input line by line { what exactly is happening here ?} and produces the output.

My main doubts are :

1) A compiler consists of a lexical analyzer, parser, intermediate code generator and code generator but what are the parts of an interpreter?

2) Who gives the run-time support to interpreted languages, I mean who manages the heap and stacks for recursive functions?

3) This is specific to the Python language:
Python comprises of a compiler stage and than interpreter stage as well
compiler produces some byte-code and and than this byte-code is interpreted by its Virtual Machine.
if I were to design only the compiler for Python (Python -> bytecode)

a) will I have to manage memory { write code to manage stack and heap } for it?

b) how will this compiler differ from the traditional compiler or say interpreter?

I know this is a whole lot to ask here but I really want to understand these minute details.

I’m referring the compiler book by Alfred V. Aho


Based on the feedback and some further study I think I should modify my question

A compiler need not produce only machine code as its output

But one question is still bugging me
Let say I want to design a ( Python->bytecode ) compiler and then bytecode will be interpreted by the virtual machine.. (correct me if I’m wrong ).
Then I’ll have to write a lexical analyzer for Python and then a parser which will generate some sort of abstract syntax tree.. after this do I have to generate some intermediate code (3 address code as mentioned in the dragon book) or direct bytecode instructions ( which I suppose will be given in the VM’s documentation ) ?

Will I have to write code for handling stack as well to provide support for recursion and scope ?

  • 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-05-26T23:09:56+00:00Added an answer on May 26, 2026 at 11:09 pm

    First off, “compiler” does not imply “outputs machine code”. You can compile from any language to any other, be it a high-level programming language, some intermediate format, code for a virtual machine (bytecode) or code for a physical machine (machine code).

    1. Like a compiler, an interpreter needs to read and understand the language it implements. Thus you have the same front-end code (though today’s interpreters usually implement far simpler language – the bytecode only; therefore these interpreters only need a very simple frontend). Unlike a compiler, an interpreter’s backend doesn’t generate code, but executes it. Obviously, this is a different problem entirely and hence an interpreter looks quite difference from a compiler. It emulates a computer (often one that’s far more high-level than real life machines) instead of producing a representation of an equivalent program.

    2. Assuming today’s somewhat-high-level virtual machines, this is the job of the interpreter – there are dedicated instructions for, among other things, calling functions and creating objects, and garbage collection is baked into the VM. When you target lower-level machines (such as the x86 instruction set), many such details need to be baked into the generated code, be it directly (system calls or whatever) or via calling into the C standard library implementation.

    3.

    • a) Probably not, as a VM dedicated to Python won’t require it. It would be very easy to screw up, unnecessary and arguably incompatible to Python semantics as it allows manual memory management. On the other hand, if you were to target something low-level like LLVM, you’d have to take special care – the details depend on the target language. That’s part of why nobody does it.

    • b) It would be a perfectly fine compiler, and obviously not an interpreter. You’d probably have a simpler backend than a compiler targeting machine code, and due to the nature of the input language you wouldn’t have quite as much analysis and optimization to do, but there’s no fundamental difference.

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

Sidebar

Related Questions

After lots of attempts and search I have never found a satisfactory way to
After reading a bit more about how Gnutella and other P2P networks function, I
After viewing some answers on stackoverflow, preg_match_all('/<img[^>]+>/i',$html, $result); $img = array(); foreach( $result[0] as
I am developing phonegap app in iphone,after successfully viewing pdf file (from server) on
After viewing answer of almost a same question on SO i added this line
I used this function to start a form: echo form_open('email/send'); and after viewing the
http://jsfiddle.net/rgbjoy/q9VGh/ - As you can see, after viewing (1), when you hit next, (2)
Simple enough, it would seem, but it turns out not to be - mainly
I have read this link How can we stop web page view after sign-out
I have a class that is able to serialize and deserialize with ease after

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.