- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Explain if the CFG is recognized by Non-deterministic push down automata

Context Free Grammars (CFG) are definitely recognized by Non-deterministic push down automata (NPDA), but Programming languages are translated to binary (Machine Code) via Deterministic PDA.

This is because it has the following below mentioned impacts −

- If Programming languages were supposed to be translated via NPDA then for one given program instance we will have multiple versions of binary(Machine code) generated for the same program, which ideally shouldn't be the scenario.
- For a given program only 1 version of binary code should be generated and that should remain consistent across all OS Platforms.
- Outputs will vary significantly: If we have multiple object files, then in 1 case output may be as expected, and on running the program again the outputs will differ since due to NPDA the process of compilation is changing and hence the object code generation also changed. So outputs are varying and in many cases it will result in wrong output.
- Multiple interpretation of syntax may lead to infinite loops: Consider a scenario where we have a loop body with terminating criteria. Via multiple ways of compilation, many keywords may be interpreted wrongly and this may lead to infinite loops if proper termination criteria are not evaluated. For example, for loop (i = 0; i< n ; i++), if that gets compiled as (i = n; i >0; i++), this will result in an infinite loop.
- Hard to debug − Due to multiple versions of object files being generated due to the NPDA process, we will find it hard to debug bugs in the code to fix them.

- Related Articles
- Explain non-deterministic push down automata in TOC?
- Explain Non-Deterministic Finite Automata in TOC.
- What is Non deterministic finite automata?
- What is Non-Deterministic Finite Automata (NFA)?
- Can we convert a non-deterministic finite automata into a deterministic finite Automata?
- What is Push down automata in TOC?
- Compare Push down automata and Linear bounded automata
- Explain Deterministic Finite Automata in TOC.
- What is Deterministic Finite Automata (DFA)?
- How to convert context free grammar to push down automata?
- Explain about a non-deterministic Turing Machine?
- Difference between Deterministic and Non-deterministic Algorithms
- Distinguish between non-deterministic, deterministic and Turing Machine computational models?
- Explain the elimination of epsilon productions in CFG
- Explain how to convert CFG to CNF

Advertisements