Start by clarifying the language's scope and constraints, then walk through the pipeline: tokenizer, parser (e.g., recursive descent with precedence climbing), and evaluator. Emphasize design choices, trade-offs, and how you handle edge cases like undefined variables and operator precedence.
Pro tip: Demonstrate production-level thinking by discussing error handling with source locations and suggesting a visitor pattern for extensibility. This shows you consider maintainability and user experience, not just a quick hack.
Ask clarifying questions about the language features, syntax, and constraints (e.g., single vs. multiple statements, variable scoping). This ensures you build the right thing and shows you think before coding.
Explain how to convert the input string into tokens (e.g., identifiers, numbers, operators, keywords). Mention handling whitespace, comments, and multi-character operators.
Describe your parsing approach, such as recursive descent with precedence climbing for expressions. Explain how you build an AST and handle statements like assignment, conditionals, and output.
Explain how to traverse the AST to execute statements and evaluate expressions. Discuss environment management for variables and control flow for conditionals.
Detail how you detect and report errors like undefined variables, type mismatches, and syntax errors. Include source location information for better diagnostics.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.