One-pass S-expression parser with nested lists and precise error handling

Quick Overview

Implement a single-pass parser for simplified S-expressions in three stages: atoms, a parenthesized list, and arbitrarily nested lists, without splitting the input. The exercise centers on error handling: detecting invalid characters, malformed numbers, unclosed or unexpected parentheses and trailing input, and stopping with a precise error position.

One-pass S-expression parser with nested lists and precise error handling

Company: Baseten

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Onsite

Overview: Implement a single-pass parser for simplified S-expressions in three stages: atoms, a parenthesized list, and arbitrarily nested lists, without splitting the input. The exercise centers on error handling: detecting invalid characters, malformed numbers, unclosed or unexpected parentheses and trailing input, and stopping with a precise error position.

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

Baseten logo
Baseten
Aug 4, 2026
mediumSoftware EngineerOnsiteSoftware Engineering Fundamentals
23
0
Loading...