VOOZH about

URL: https://www.geeksforgeeks.org/compiler-design/yacc-program-to-recognize-string-with-grammar-anbn-n0/

⇱ YACC program to recognize string with grammar { a<sup>n</sup>b<sup>n</sup> | n&ge;0 } - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

YACC program to recognize string with grammar { anbn | n≥0 }

Last Updated : 11 Jul, 2025
Problem: Write YACC program to recognize string with grammar { anbn | n≥0 }. Explanation: Yacc (for “yet another compiler compiler.”) is the standard parser generator for the Unix operating system. An open source program, yacc generates code for the parser in the C programming language. The acronym is usually rendered in lowercase but is occasionally seen as YACC or Yacc. Examples:
Input: ab
Output: valid string

Input: aab
Output: invalid string

Input: aabb
Output: valid string

Input: abb
Output: invalid string

Input: aaabbb
Output: valid string 
Lexical Analyzer Source Code : Parser Source Code : Output: 👁 Image
Comment
Article Tags:

Explore