B.
Back to projects

Recursive Descent Syntax Recogniser

Overview

Expanded an existing compiler harness to add a custom recursive-descent syntax analyser for an Ada-like grammar. The parser consumed a token stream to validate programs against a formal grammatical structure and comprehensively reported errors on failures with syntax tracing.

Why it’s interesting

This project taught me a lot about compiler and language design. Handling complex nested structures and functions gave me an appreciation for how modern compilers are designed. Learning how to validate programs to a given grammar and returning clean traces of how and where they went wrong was incredibly rewarding.

Key Technical Points

  • Recursive Descent: Parsed over programs using a custom Recursive Descent Analyser to validate code against a formal grammar.
  • Supports Complex Structures: Successfully parsed over complex, nested logic like conditionals, nested iteration and recursive procedures. Also added support for multiple operators.
  • Context-free Grammar: Translated formal Ada-like grammar from paper into YACC format.
  • Robust error reporting: Added contextual error propagation and syntax tracing so invalid programs were rejected with useful, readable reports showing where parsing failed.

Tech Stack

Language: Java