Questions and Corresponding Answers
with Surety of 100% Pass Mark
lex - lexical analysis - 🧠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 - 🧠ANSWER ✔✔converts a token stream into a
parsetree eg (abstract) syntax tree
trans - Translation (linearization) - 🧠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 - 🧠ANSWER ✔✔translates intermediate code
into target machine code— eg assembly
COPYRIGHT©JOSHCLAY 2025/2026. YEAR PUBLISHED 2025. COMPANY REGISTRATION NUMBER: 619652435. TERMS OF USE. PRIVACY
1
STATEMENT. ALL RIGHTS RESERVED
, Assembler - 🧠ANSWER ✔✔convert text instructions into binary instructions
eg .s to .o on Linux or .asm to .obj on windows, substitutes addresses for
labels
Disassembler - 🧠ANSWER ✔✔convert object file back into assembler level
form
Multi-pass compiler - 🧠ANSWER ✔✔n front-ends (lex/syn) & m back-ends,
gives nm compilers for n languages into m architectures
Static/Global Variables - 🧠ANSWER ✔✔allocated to fixed location in
memory
Local Variables - 🧠ANSWER ✔✔need multiple copies for recursion etc,
allocated to fixed offset from $fp (4*n)
Stack - 🧠ANSWER ✔✔mem block in which stack frames are allocated,
function call allocates a new stack frame, return de-allocates
$fp - 🧠ANSWER ✔✔MIPS register points to stack frame of currently active
function
$sp - 🧠ANSWER ✔✔points to lowest used location
COPYRIGHT©JOSHCLAY 2025/2026. YEAR PUBLISHED 2025. COMPANY REGISTRATION NUMBER: 619652435. TERMS OF USE. PRIVACY
2
STATEMENT. ALL RIGHTS RESERVED