AIMA Artificial Intelligence a modern approch

AIMA-exercises is an open-source community of students, instructors and developers. Anyone can add an exercise, suggest answers to existing questions, or simply help us improve the platform. We accept contributions on this github repository.

Exercise 23.6

This exercise concerns grammars for very simple languages.

  1. Write a context-free grammar for the language $a^n b^n$.

  2. Write a context-free grammar for the palindrome language: the set of all strings whose second half is the reverse of the first half.

  3. Write a context-sensitive grammar for the duplicate language: the set of all strings whose second half is the same as the first half.

View Answer