Compilers
Compiler interviewing
Getting an offer at the compiler teams at Google, Apple, or JetBrains means going through interviews that ask: 'Why is dangling else ambiguous?', 'How does escape analysis remove GC pressure?', 'Design a JIT for an embedded system with 64MB RAM'. These questions do not require knowing every compiler. They require understanding principles and reasoning about trade-offs. This lesson is the synthesis of the whole course through the lens of real interviews.
- **Apple compiler team** (Xcode/Metal/Swift) design interviews ask: 'How would you implement incremental compilation for Swift?' The expected answer covers Salsa-like incremental computation and a discussion of transformation granularity
- **Google V8 team** asks: 'When does TurboFan deoptimize a function and what happens next?' The senior answer covers deoptimization materialization, OSR, and the reoptimization mechanism
- **Meta/Instagram PyTorch compiler team** asks about torch.compile internals: dynamo tracing, AOT autograd, compiler backends. Expected knowledge: MLIR basics and AOT vs JIT trade-offs for ML inference
Parsing questions
Interviews for compiler teams expect you to understand parsing algorithms, their limits, and where to apply them. LL(k) vs LR(k): LL is top-down predictive, LR is bottom-up with lookahead. PEG grammars are deterministic by definition. In practice, most modern compilers use hand-written recursive descent.
JetBrains (the makers of IntelliJ IDEA) often ask IDE team interviewees about error recovery in parsers and incremental parsing. Apple's compiler team (clang/swift) asks about LR vs LL and why Swift chose recursive descent. Google compiler teams ask about LLVM pass scheduling and alias analysis.
Why can C++ not be parsed correctly without semantic information (symbol table)?
Optimization questions
Optimization questions in interviews test your understanding of when an optimization applies and what its real impact is. You need to know which problem the optimization solves, when it is safe, how to measure its impact, and which optimizations LLVM applies automatically.
At Google Brain (ML compilers), interviewers ask about loop transformations (tiling, interchange, fusion) and the polyhedral model. Apple Silicon's compiler team asks about vectorization and SIMD. The Cloudflare Workers team asks about Wasm compilation and security isolation through capability-based security.
Why can aggressive inlining hurt performance despite removing call overhead?
VM design questions
VM design questions test systems thinking: how the JVM, V8, and CPython are built, what that means for performance, and which design decisions would change today. At senior levels, interviewers expect concrete numbers and trade-offs.
Netflix, LinkedIn, and Twitter run the JVM in production with carefully tuned GC parameters: Kafka on ZGC (-XX:+UseZGC -Xmx16g), Elasticsearch on G1 (-XX:MaxGCPauseMillis=200). Understanding these flags is expected at senior Java/Scala roles in these companies.
Why does JVM escape analysis allow stack allocation of objects?
Trade-offs and system design
System questions at senior+ levels: design a compiler for specific requirements. There is no single right answer. What matters is structured thinking: identify requirements, name trade-offs, choose a concrete approach with justification.
Compiler roles at Apple (Xcode, Metal, LLVM), Google (V8, Go, XLA), Meta (HHVM, PyTorch compiler), and JetBrains (IntelliJ Kotlin compiler) typically include 1-2 coding rounds (LeetCode medium/hard), 2-3 design rounds (compiler and systems), and 1 values/culture round. The design rounds are the key: you must show real-world trade-off understanding, not just academic knowledge.
A compiler interview requires you to know everything from lexer to register allocator
Depth in a few areas and understanding of trade-offs matter more than shallow knowledge of everything. Interviewers look for engineering thinking: 'why' matters more than 'what'
Specialization is normal. An engineer on the JIT team may not know parser details. An engineer on the GC team is not expected to know instruction selection. But everyone must understand how the components interact and which trade-offs were made in their system
On a compiler design question, where do you start a structured answer?
Key ideas
- Parsing questions: C++ requires semantic info to parse. PEG is deterministic (no ambiguity) vs CFG. Dangling else is the classic ambiguity
- Optimization questions: know the conditions of applicability (alias analysis for SIMD, escape for stack allocation) and when an optimization hurts (inlining code bloat)
- System design: start with requirements/constraints. Structure your answer as trade-offs, not a technology list. Depth in a few areas beats breadth
Related topics
This is the final lesson of the course - a synthesis of every compiler concept:
- JIT basics — Tiered compilation (V8 Ignition/Sparkplug/Maglev/TurboFan) is a core topic in VM design questions
- Advanced GC — ZGC, Shenandoah, and write barriers are typical VM design questions at senior roles
- LLVM infrastructure — LLVM IR, passes, and ThinLTO are baseline knowledge for compiler team roles at Apple/Google/ARM
Вопросы для размышления
- Which section of the compiler course was most unexpected or counter to your initial expectations? Why?
- If you had to pick one compiler project to study deeply (rustc, V8, GCC, LLVM, CPython), which one and why? What does the choice say about your professional interests?
- Compiler engineer vs regular software engineer: which skills differ fundamentally? Which product teams gain a non-obvious advantage from compiler knowledge?