first( P, c): generate the first extension of candidate c.accept( P, c): return true if c is a solution of P, and false otherwise.
![what is backtracking in compiler design what is backtracking in compiler design](https://academyera.com/wp-content/uploads/2021/03/parsers.png)
![what is backtracking in compiler design what is backtracking in compiler design](https://slidetodoc.com/presentation_image_h/acb29cc3cd4fdb55cb0e0be4c0b72834/image-27.jpg)
![what is backtracking in compiler design what is backtracking in compiler design](https://ecomputernotes.com/images/leftmost-derivation-Example-1.jpg)
The classic textbook example of the use of backtracking is the eight queens puzzle, that asks for all arrangements of eight chess queens on a standard chessboard so that no queen attacks any other. Backtracking is a general algorithm for finding solutions to some computational problems, notably constraint satisfaction problems, that incrementally builds candidates to the solutions, and abandons a candidate ("backtracks") as soon as it determines that the candidate cannot possibly be completed to a valid solution.