Save
computer science paper 1
1.1 Characteristics of Contemporary Processors
programming language translators
Save
Share
Learn
Content
Leaderboard
Share
Learn
Created by
Alexia Quiboloy
Visit profile
Cards (33)
What is the role of an assembler?
Translates
assembly code
into
machine code
View source
How does a compiler differ from an interpreter?
A compiler translates the whole
program
at once
View source
When is it appropriate to use a compiler?
When the entire
program
needs to be executed
View source
Why is bytecode produced by some compilers?
It serves as an intermediate step to
machine code
View source
What are the stages of compilation?
Lexical analysis
, syntax analysis, code generation,
optimisation
View source
What is the function of linkers in compilation?
They link libraries to the
executable
code
View source
What does a loader do?
Copies the
program
into
main memory
for execution
View source
What is assembly code?
A low-level language easier than
machine code
View source
Why is machine code difficult for humans?
It is hard to read, write, and
debug
View source
What is the output of a compiler called?
Object code
View source
What is the purpose of lexical analysis?
To remove
unnecessary
spaces and comments
View source
What does a symbol table do?
Tracks
run-time
memory addresses
for identifiers
View source
What is syntax analysis responsible for?
Checking phrases against
language rules
View source
What is semantic analysis?
Checks for
valid
program logic despite valid syntax
View source
What is code generation?
Creating
machine code
from
checked source code
View source
What is code optimisation?
Improving code
efficiency
by removing
redundancies
View source
What are libraries in programming?
Pre-written
functions
for common tasks
View source
How does a linker work with libraries?
It adjusts
memory addresses
for library
functions
View source
What happens during the loading process?
The
loader
relocates
memory addresses
for execution
View source
What are the advantages of using a compiler?
Faster
execution
of programs
Executable code does not require an
interpreter
Can run multiple times without recompilation
View source
What are the advantages of using an interpreter?
Easier debugging of code
Immediate execution of code
No need to recompile for small errors
View source
What are the stages of compilation in detail?
Lexical analysis
: Remove spaces/comments, create
tokens
Syntax analysis: Check phrases against
language rules
Semantic analysis: Validate program logic
Code generation: Generate
machine code
Code optimisation: Improve
efficiency
View source
What is the process of converting source code to executable code?
Source code is
lexed
Syntactically
and
semantically
analysed
Optimised
for efficiency
Executable code is generated
View source
What is the role of the Java Virtual Machine (JVM)?
Interprets
bytecode
produced by Java
compilers
Allows Java programs to run on any
machine
View source
What are the disadvantages of code optimisation?
May complicate
debugging
Can lead to less
readable
code
Might introduce new
errors
View source
What are the types of programming languages based on translation methods?
Compiled languages
: Translated entirely before execution
Interpreted languages
: Translated line by line during execution
Hybrid languages
: Use both compilation and interpretation
View source
What is the significance of syntax rules in programming languages?
Define
valid structures
for code
Help in error detection during
compilation
View source
What is the purpose of a symbol table in compilation?
Keeps track of
identifiers
and their memory addresses
Aids in
semantic analysis
and
code generation
View source
What are the common types of libraries used in programming?
Standard libraries
: Pre-written functions for common tasks
Custom libraries
: Functions written by programmers for specific needs
View source
What is the difference between high-level and low-level languages?
High-level languages: Easier for humans to read and write
Low-level languages: Closer to
machine code
, harder for humans
View source
What is the role of the lexer in compilation?
Converts source code into
tokens
Removes unnecessary elements like
spaces
and comments
View source
What is the importance of semantic analysis in compilation?
Ensures that the program logic is valid
Detects errors that are
syntactically
correct but
semantically
incorrect
View source
What is the function of the loader in the execution process?
Loads the
executable
code into memory
Adjusts
memory addresses
for execution
View source