Translators Flashcards Preview

Paper 2 - Computer Science > Translators > Flashcards

Flashcards in Translators Deck (16)
Loading flashcards...
1

What is Source Code?

Source code is the program code that is written by a programmer. Most source code programs are text files that can be created using a simple text editor.

2

When does source code need to be translated before it can be executed?

-When it's written in high level languages, source code needs to be translated into machine code.
-If they're already in machine code they don't need to be translated.
-The processor can only analyse machine code

3

What does machine architecture–dependent mean?

To run a program, the source code must be translated into object code according to the low-level features of the operating system and the instruction set has to be hardcoded into the computer's chipset

4

What are high level languages?
Give 2 examples

- Languages that are...
Python, Java

5

What are low level languages?
Give 2 examples

- Languages that sit close to the computer's instruction set
-Assembly language, Machine code

6

How is it determined which translator is used to translate a high level language?

It's determined by the particular implementation of a programming language, some provide only one option, some provide both

7

What does a compiler do?

It translates the code all at once but does not execute it

8

What are the advantages of using a compiler?

-Produces executable code in a form that cannot be read by a human or readily reverse-engineered, so the source code is more protected
- It translates all the code at once so it's faster
- Appropriate when the object code is going to be distributed or sold

9

What does an interpreter do?

Interpreters translate and execute each line of source code one by one

10

What are the advantages of using an interpreter?

-can test the code and to quickly identify and fix errors.
-Interpreters are useful in the development stage of a program as they don't need to recompile every time an error is discovered

11

What does an assembler do?

Assemblers translate assembly code programs into machine code.

12

What is Bytecode?

Bytecode is source code that has been compiled into low-level code designed to be run on a virtual machine so it speeds up the translation process.

13

2 advantages of using Bytecode

- The source code is executable on a wide range of platforms as its platform independent
- Provides an extra level of protection as a separate bytecode interpreter is used.

14

How does an assembler translate code from a high level into a low level?

It translates the source code (the input) into the equivalent 1's and 0's in machine code, producing object code.

15

How does a compiler translate code from a high level into a low level?

It scans over the source code several times performing checks and building up tables of information to produce the final object code

16

How does an interpreter translate code from a high level into a low level?

-It uses subroutines that carry out high level instructions
-It analyses each line of source code for syntax errors, if there are none it calls the appropriate subroutine to execute the command.