Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Document preview thumbnail
Vista previa 2 fuera de 10 páginas
Examen

Compiler Construction UPDATED Exam Questions and CORRECT Answers

Document preview thumbnail
Vista previa 2 fuera de 10 páginas

Compiler Construction UPDATED Exam Questions and CORRECT Answers lex - lexical analysis - CORRECT ANSWER - converts a character stream to token stream, removes whitespace & comments. Write regular expression decription of tokens, create DFA and turn into code. Generally need 1 token buffer to find end of token, may also need higher priority in the case where there is more than one match eg keywords vs. variables names. RE/FA can't match brackets, require context-free grammars for this syn - Syntax analysis - CORRECT ANSWER (abstract) syntax tree - converts a token stream into a parsetree eg trans - Translation (linearization) - CORRECT ANSWER - converts a tree into simple (linear) intermediate code eg JVM, deals with scope & allocation of variables, determining the type of expressions, selection of overloaded operators

Vista previa del contenido

Compiler Construction UPDATED Exam
Questions and CORRECT Answers
lex - lexical analysis - CORRECT ANSWER - converts a character stream to token stream,
removes whitespace & comments. Write regular expression decription of tokens, create DFA and
turn into code. Generally need 1 token buffer to find end of token, may also need higher priority
in the case where there is more than one match eg keywords vs. variables names. RE/FA can't
match brackets, require context-free grammars for this


syn - Syntax analysis - CORRECT ANSWER - converts a token stream into a parsetree eg
(abstract) syntax tree


trans - Translation (linearization) - CORRECT ANSWER - converts a tree into simple
(linear) intermediate code eg JVM, deals with scope & allocation of variables, determining the
type of expressions, selection of overloaded operators


cg - Target Code Generation - CORRECT ANSWER - translates intermediate code into
target machine code— eg assembly


Assembler - CORRECT ANSWER - convert text instructions into binary instructions eg .s
to .o on Linux or .asm to .obj on windows, substitutes addresses for labels


Disassembler - CORRECT ANSWER - convert object file back into assembler level form



Multi-pass compiler - CORRECT ANSWER - n front-ends (lex/syn) & m back-ends, gives
nm compilers for n languages into m architectures


Static/Global Variables - CORRECT ANSWER - allocated to fixed location in memory



Local Variables - CORRECT ANSWER - need multiple copies for recursion etc, allocated
to fixed offset from $fp (4*n)

, Stack - CORRECT ANSWER - mem block in which stack frames are allocated, function
call allocates a new stack frame, return de-allocates


$fp - CORRECT ANSWER - MIPS register points to stack frame of currently active
function


$sp - CORRECT ANSWER - points to lowest used location



Stack Frame - CORRECT ANSWER - has pointer to previous stack frame (FP') and return
address (RA) - stack linkage information


Stack Parameter Passing - CORRECT ANSWER - caller pushes args onto $sp, parameters
then accessed at $fp+8,12 etc


Address Space Map - CORRECT ANSWER - code, static data, stack and heap segments



Just in Time Compilation - CORRECT ANSWER - distribute intermediate code and
perform cg once host architecture is known (eg JVM)


Character-stream form - CORRECT ANSWER - early interpreters which would re-lex &
re-parse statements when they were encountered


Token-stream form - CORRECT ANSWER - parsing can be done when program is read eg
BBC Basic stored token form reparsed on execute


Syntax-tree form - CORRECT ANSWER - natural & simple, commonly used for PHP or
Python

Información del documento

Subido en
9 de abril de 2025
Número de páginas
10
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas
$13.49

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
MGRADES
4.0
(232)
Vendido
1526
Seguidores
108
Artículos
107179
Última venta
2 horas hace




Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes