1.2.2a - translators (y12) Flashcards
What is a translator?
Software that converts source code to machine code.
What are the types of translators?
Compiler, interpreter, assembler.
What does a compiler do?
Converts entire source code to machine code before execution.
What does an interpreter do?
Translates and runs code line by line.
What does an assembler do?
Converts assembly language to machine code.
Which is faster: compiler or interpreter?
Compiler – produces an executable.
What’s a drawback of compilers?
Harder to debug – entire program must compile.
What’s a drawback of interpreters?
Slower execution – translates each time.
What is source code?
Code written by a programmer in a high-level language.
What is object code?
Code translated into machine code by a compiler.
What is machine code?
Binary instructions understood by the CPU.
What is assembly language?
Low-level language using mnemonics.
Why is translation necessary?
Computers can only execute machine code.
What’s the role of error checking in translators?
Finds syntax and semantic errors.
What is lexical analysis?
Removing whitespace/comments and converting tokens.
What is syntax analysis?
Checking code structure against language rules.
What is semantic analysis?
Ensuring code makes logical sense.
What is code generation?
Produces object code from parsed source code.
What is optimisation?
Improving object code efficiency during compilation.
Which translator is best for development?
Interpreter – allows testing code in real-time.
Which translator is best for deployment?
Compiler – faster execution, no source code needed.
Why use assembly language?
Greater control and speed – useful in embedded systems.
What is a token?
A meaningful element like a keyword, identifier, or symbol.
What is a symbol table?
Stores variables, functions, and their attributes during compilation.