Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.

Looking for the book? They have it at the Engineer's Bookstore at 748 Marietta St NW. Here is there website: http://www.engrbookstore.com/ - Monica

Hotspots: Slides and CodeTA CornerComments?AnnouncementsFAQStatic Webspace
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Final Exam Review Spring 2004: Compilers, interpreters, and languages, oh my!

Link back to Sp2004 Final Exam Review

Questions and Answers?



1 If you had a program written in C and you ran it through a C compiler, what would you expect to get out?
you would expect to get the program without being translated, it just follows the instructions

2 If you had a program written in Java and you ran it through a Java compiler, what would you expect to get out? a program written in Java would have to be translated before it was executed, therefore it would take longer than a program written in C++ or C.

3 Why in the world would anyone want to use a virtual machine interpreter, and what does that have to do with programmable toaster ovens and cell phones?
we need this to understand what the computer is doing, and to tell the computer, or toaster oven, or cell phone to do a certain task.

4 What's a scripting language?
a language that non-professional programmers can easily use to solve relatively simple tasks. example: javascript

5 What is machine language? How does it differ from assembler language?
machine language is the only language that a basic computer can understand. the instructions are values in the bytes in memory and they tell the computer to do very low-level activities. assembler language are sets of words that correspond one to one with machine language.

6 What does it mean for a language to be "interpreted"?
interpretted means it has to be translated before it is executed.

7 Why is that executing the same thing in JES and Photoshop is always faster in Photoshop?
Photoshop does not have to translate the code before it executes it... instead it uses algorithms.

1. That's the idea: you get the program, but in a form that can be executed without translation. What is that form (or "language") called?

2. Yes, it would take longer, but what form/language is it in? (Clue: think xxxx-code)

3. A certain language (I wonder which one?) uses a VM interpreter and was originally developed specifically for running software controlled consumer devices.

4. Nice.

5. Ah, see Q1

6. In general, yes, but that's also true of compilation. Interpretation and compilation are usually contrasted. When/in what sized chunks is code translated as its interpreted as opposed to when it's compiled?

Colin Potts

IS NUMBER 3 JAVA?

Yes, Java uses a VM, but why does anyone use Java? Mark Guzdial


1) language...machine language?

1) C run through a Compiler yields machine language.
2) Java is compiled for the Java Virtual Machine and then to Java machine language. (pg. 287)
3) The java virtual machine interpreter can very easily be made to run on any processor. When a program in Java is compiled once, it can be run everywhere, including devices as small as wristwatches and cell phones.
4) Scripting language is meant to be used easily by non-professional programmers to solve relatively simple tasks. (pg. 316)
5) Machine language is the only language a computer actually understands. It consists of values in bytes in memory that tell computers to do very low level activities. Assembler language are a set of words or near words that corresponds one to one with machine language. Assembler instructions tell the computer to do things likes store numbers into particular memory locations or into special locations in the computer; test numbers for equality or comparision; or add numbers together or subtract them.
6) When a language is interpreted, it must be translated into another language before it can be understood by the computer, instead of like machine language, just being able to perform the task.
7) Photoshop is written in either C or C++ and run through a compiler, thus put directly into the machine language which the computer understands and thus runs very quickly. JES is Jythong, which is a type of Python, which like Java must be interpreted, not once, but twice before it can be understood by the computer. This is why Photoshop will always be faster than Jes.

How do these look?

Kelli Webb

So is the major difference betweeen language "interpretation" and "compilation" is that interpretation is the translation of a program into something other than machine language while compilation of a program is directly into machine language??

Interpretation does not involve any translation at all! Consider me reading some instructions in French. My French is barely understandable on good days, but I could probably do the instructions. That's intepretation. But maybe I could rewrite the instructions in English first. Given that it's my mother tongue, I bet I'd execute those instructions much faster once they're in English. That's compilation Imagine that I had to repeat those instructions many times. Translating them once to English and then always executing the English would be faster than my trying to figure out the French each time. Does that help? Mark Guzdial
BTW, it's "Jython" not "Jythong." Mark Guzdial


Jythong is funnier...if i created it i would call it that

ok, your explanation of interpretation helps me understand it better, but I'm still having trouble answering the what does if mean for a computer language to be interpreted question. It just means that the computer instead of compiling it into machine language goes straight from the program to executing it via something like the VM interpreter?
Heather Symon

Take a look in the book at the tiny graphics language interpreter. There's no VM there – the program just DOES what the input program says to do. Mark Guzdial


6. When a program is interpreted, it is read and executed as machine language as the program is running.

Is this right?

It doesn't really matter if the interpreter is written in machine language or not. When a program is interpreted, it's just executed. The question of compilation or not is whether a NEW program is created based on the INPUT program. A compiler writes out a new program, typically in machine language. An interpreter does not. Mark Guzdial





Link to this Page