Design a Multilingual Written-Number Parser with a Stack

Read the full interview experience this question came from →

Quick Overview

Design a multilingual written-number parser by separating language rules from shared arithmetic evaluation. Work through stack-based evaluation, nested units, validation, and the limits of removing fixed section groupings.

Design a Multilingual Written-Number Parser with a Stack

Company: Microsoft

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: hard

Interview Round: Onsite

Design a parser that converts written number expressions in languages such as English, Chinese, and Japanese into numeric values. Compare a section-accumulation approach with a stack-based approach. The reported discussion specifically distinguishes a necessary token-to-value mapping from a desire to avoid hard-coding a fixed three-digit or four-digit section grouping in the core evaluator. ### Scope and Clarifying Questions The source supplies no complete accepted-language grammar, tokenization rules, examples of all valid forms, or numeric bounds. Treat this as an implementation-design exercise rather than inventing a universal graded parser. Explain which knowledge a stack can centralize and which language rules remain necessary. State the supported subset for a worked example, and distinguish parsing invalid text from guessing an intended value. ### What a Strong Answer Covers Provide a concrete pipeline with lexicon, parsing, evaluation, and validation responsibilities. Work through a complete example and explain how nested units are represented. Compare the invariants and limitations of stack evaluation and section accumulation without claiming that a data structure removes the need for linguistic semantics. ### Follow-up Questions What would you do with an unknown token or an ambiguous phrase? How would you test numbers whose grouping differs across languages? What additional policies are needed for fractions, negative numbers, or mixed-language input?

Overview: Design a multilingual written-number parser by separating language rules from shared arithmetic evaluation. Work through stack-based evaluation, nested units, validation, and the limits of removing fixed section groupings.

Read the full Microsoft Software Engineer interview experience this question came from

Microsoft logo
Microsoft
Apr 1, 2026
hardSoftware EngineerOnsiteSoftware Engineering Fundamentals
0
0

Design a parser that converts written number expressions in languages such as English, Chinese, and Japanese into numeric values. Compare a section-accumulation approach with a stack-based approach. The reported discussion specifically distinguishes a necessary token-to-value mapping from a desire to avoid hard-coding a fixed three-digit or four-digit section grouping in the core evaluator.

Scope and Clarifying Questions

The source supplies no complete accepted-language grammar, tokenization rules, examples of all valid forms, or numeric bounds. Treat this as an implementation-design exercise rather than inventing a universal graded parser. Explain which knowledge a stack can centralize and which language rules remain necessary. State the supported subset for a worked example, and distinguish parsing invalid text from guessing an intended value.

What a Strong Answer Covers Guidance

Provide a concrete pipeline with lexicon, parsing, evaluation, and validation responsibilities. Work through a complete example and explain how nested units are represented. Compare the invariants and limitations of stack evaluation and section accumulation without claiming that a data structure removes the need for linguistic semantics.

Follow-up Questions Guidance

What would you do with an unknown token or an ambiguous phrase? How would you test numbers whose grouping differs across languages? What additional policies are needed for fractions, negative numbers, or mixed-language input?