Comprehensive Compilers and Interpreters Flashcards
Table of Contents
- Compilers and Interpreters Flashcards
- What is a compiler? drill compilers_interpreters
- What is an interpreter? drill compilers_interpreters
- Main difference between compiler and interpreter drill compilers_interpreters
- Advantages of compiled languages drill compilers_interpreters
- Advantages of interpreted languages drill compilers_interpreters
- Examples of compiled languages drill compilers_interpreters
- Examples of interpreted languages drill compilers_interpreters
- What is a Just-In-Time (JIT) compiler? drill compilers_interpreters
- Lexical analysis in compilation drill compilers_interpreters
- Parsing in compilation drill compilers_interpreters
Compilers and Interpreters Flashcards
What is a compiler? drill compilers_interpreters
Front
What is a compiler?
Back
A compiler is a program that translates source code written in a high-level programming language into machine code or another lower-level representation, typically before runtime.
What is an interpreter? drill compilers_interpreters
Front
What is an interpreter?
Back
An interpreter is a program that directly executes instructions written in a programming or scripting language, without previously converting them to machine language.
Main difference between compiler and interpreter drill compilers_interpreters
Front
What is the main difference between a compiler and an interpreter?
Back
The main difference is that a compiler translates the entire source code into machine code before execution, while an interpreter translates and executes the source code line by line at runtime.
Advantages of compiled languages drill compilers_interpreters
Front
List some advantages of compiled languages.
Back
- Faster execution time
- Better optimization possibilities
- No need for source code distribution
- Easier detection of certain types of errors before runtime
Advantages of interpreted languages drill compilers_interpreters
Front
List some advantages of interpreted languages.
Back
- Platform independence (write once, run anywhere)
- Easier debugging and testing
- Dynamic typing and runtime modification
- Often simpler to implement
Examples of compiled languages drill compilers_interpreters
Front
Name some examples of commonly compiled languages.
Back
- C
- C++
- Rust
- Go
- Fortran
Examples of interpreted languages drill compilers_interpreters
Front
Name some examples of commonly interpreted languages.
Back
- Python
- JavaScript
- Ruby
- PHP
- Perl
What is a Just-In-Time (JIT) compiler? drill compilers_interpreters
Front
What is a Just-In-Time (JIT) compiler?
Back
A JIT compiler is a hybrid approach that combines compilation and interpretation. It compiles parts of the code at runtime, just before execution, to improve performance while maintaining some benefits of interpretation.
Lexical analysis in compilation drill compilers_interpreters
Front
What is lexical analysis in the context of compilation?
Back
Lexical analysis, also known as tokenization, is the process of converting a sequence of characters in the source code into a sequence of tokens (meaningful units like keywords, identifiers, and literals).
Parsing in compilation drill compilers_interpreters
Front
What is parsing in the context of compilation?
Back
Parsing is the process of analyzing the structure of the tokens produced by lexical analysis according to the grammar of the programming language, typically resulting in an abstract syntax tree (AST).