Programming Language Translators Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is assembly code?

A

Low-level language, with each instruction in assembly code almost always neigh equivalent to one machine code instruction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Before assembly code program can be executed, what must it be translated into?

A

Equivalent machine code, or an intermediate form called bytecode, this is done by a program called an assembler

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a complier?

A

A program that translate a high-level language into machine code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How does a complier work?

A

The source code, is input as data to the complier who scans it through several time, each time performing different checks and building up tables of information needed to produce the final object code, the object code can then be saved and run whenever needed without the presence of the complier

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is an interpreter?

A

A different type of programming language translator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How does a interpreter work?

A

Once the programmer has written and saved a program, and runs it, the interceptor looks at each line of the program, analyses it and, if no syntax error translates it into machine code and runs it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is bytecode?

A

An intermediate representation which combines compiling and interpreting when interpreting each line of code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is some advantages

A

You can achieve platform independence, which masks inherent difference between different computer architectures and operating systems
Kt acts as an extra security layer between your computer and the program, as you can download an untruest program and you then execute the Java bytecode interpreter rather than the program itself, which guards against malicious programs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the 4 advantages a complier has over an interpreter?

A

The object code can be saved on disk and run whenever required without the need to recompile, however if an error is discovered the whole program had to be recompiled
The Object code executed faster than in interpreted code
The object code produced by a complier can be distributed or executed without having to have the complier present
The object code is more secure, as t cannot be read without a great deal of ‘reverse engineering’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the 2 advantages an interpreter has over a compiler?

A

Platform independence
It is useful for program development as there is no need for lengthy recompilation each time an error is discovered

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the disadvantages of an interpreter?

A

The program may run slower, because each statement has to be translated to machine code each time it is encountered

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the 3 stages of complication?

A

Lexical analysis, syntax analysis and code generation and optimisation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the functions lexical analysis performs>

A

Superfluous spaces are removed
All comments are removed
Some simple error-checking is performed like illegal identifier or an attempt to assign an illegal value to a constant that might cause overflow or underflow
A,, keywords, constants and identifiers used in the source code are replaced by ‘tokens’ (unique symbols)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does a symbol table contain?

A

An entry for every keyword and identifier in the program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the most common way of organising the symbol table?

A

A hash table, where the keywords or identifier is ‘hashed’ to produce an array subscript

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is syntax analysis?

A

The process of determining whether the sequence of input characters, symbols, items or tokens form a valid sentence in the language

17
Q

What is parsing?

A

The task of systematically applying the set of rules to each statement to determine whether it is valid, stack will be used to check

18
Q

What is semantics, which is checked in the syntax analysis?

A

Define the meaning rather than the grammar of the language

19
Q

What do code optimisation techniques attempt to reduce?

A

The execution time of the object program

20
Q

What is the disadvantages of code optimisation?

A

It will increase completion time, sometimes quite considerably
It may sometimes produce unexpected results

21
Q

What us the job of the linker?

A

To put appropriate machine address in all the external ‘call’ and ‘return’ instructions