PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/System Design/Jane Street

Design and implement a tiny language runtime

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency in programming-language implementation—lexical analysis, recursive-descent parsing, AST construction, static semantic checks, and runtime execution (interpreter or VM)—as well as software design for extensibility, scoping, error reporting, and complexity reasoning.

  • hard
  • Jane Street
  • System Design
  • Machine Learning Engineer

Design and implement a tiny language runtime

Company: Jane Street

Role: Machine Learning Engineer

Category: System Design

Difficulty: hard

Interview Round: Technical Screen

You are given a specification for a minimal imperative programming language. Tokens include identifiers, integers, operators (+, -, *, /), comparisons (<, <=, >, >=, ==, !=), assignment (=), and punctuation (;, (, ), {, }). Statements include variable declaration (let x = ...;), assignment, if/else, while, and print(expr);. Expressions support integer arithmetic and parentheses. Using your preferred language, implement: ( 1) a tokenizer and a recursive-descent parser that builds an AST for a grammar you define; ( 2) static checks for undefined variables and integer-only type consistency; ( 3) either an AST interpreter or a bytecode compiler plus VM—choose one and justify it. Then answer: How would you extend the design to support user-defined functions with lexical scoping and a call stack? How would you organize classes and interfaces (OOD) to make adding new statements/operators low-friction while keeping the interpreter/compiler cohesive? How will you implement syntax/semantic error reporting with line/column tracking and recovery to continue parsing? What are the time and space complexities of tokenization, parsing, and execution with respect to program length?

Quick Answer: This question evaluates proficiency in programming-language implementation—lexical analysis, recursive-descent parsing, AST construction, static semantic checks, and runtime execution (interpreter or VM)—as well as software design for extensibility, scoping, error reporting, and complexity reasoning.

Related Interview Questions

  • Design exchange–trading system message flow - Jane Street (easy)
  • Validate order book data across multiple databases - Jane Street (easy)
  • Implement compiler for custom language - Jane Street (hard)
Jane Street logo
Jane Street
Aug 1, 2025, 12:00 AM
Machine Learning Engineer
Technical Screen
System Design
10
0

Minimal Imperative Language — Design and Implementation Task

Context

You are asked to design and implement a minimal imperative language and its tooling. The language supports integers, variables, arithmetic, comparisons, conditionals, loops, and printing. You must decide and document a concrete grammar, implement a tokenizer and recursive-descent parser that produce an AST, perform basic static checks, and execute programs.

Language Specification (to implement)

  • Tokens: identifiers, integers, operators (+, -, *, /), comparisons (<, <=, >, >=, ==, !=), assignment (=), punctuation (;, (, ), {, }).
  • Statements:
    1. Variable declaration: let x = expr;
    2. Assignment: x = expr;
    3. Conditional: if (expr) { ... } else { ... }
    4. Loop: while (expr) { ... }
    5. Print: print(expr);
  • Expressions: integer arithmetic and parentheses.

Deliverables

  1. Implement a tokenizer and a recursive-descent parser that builds an AST for a grammar you define.
  2. Implement static checks for undefined variables and integer-only type consistency.
  3. Implement either:
    • an AST interpreter, or
    • a bytecode compiler plus VM. Choose one, implement it, and justify the choice.

Design Extensions and Discussion

  • How would you extend the design to support user-defined functions with lexical scoping and a call stack?
  • How would you organize classes and interfaces (OOD) to make adding new statements/operators low-friction while keeping the interpreter/compiler cohesive?
  • How will you implement syntax/semantic error reporting with line/column tracking and recovery to continue parsing?
  • What are the time and space complexities of tokenization, parsing, and execution with respect to program length?

Solution

Show

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More Jane Street•More Machine Learning Engineer•Jane Street Machine Learning Engineer•Jane Street System Design•Machine Learning Engineer System Design
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.