Parsing Expression Grammar and Packrat Parsing – A Review


Nikhil S. Mangrulkar, Kavita R. Singh
Department of Computer Technology, Yeshwantrao Chavan College of Engineering, Nagpur, Maharashtra, India.
Mukesh Raghuwanshi
Department of Computer Engineering, G. H. Raisoni College of Engineering and Management, Pune, Maharashtra, India.
Shashidhar R
Department of Electronics and Communication Engineering, Sri Jayachamarajendra College of Engineering, Mysuru, Karnataka, India.


Bryan Ford presented Parsing Expression Grammars (PEGs) as an alternative to specify rules for programming language, along with a Packrat parser, based on an idea of memoization. The idea proposed by B. Ford guarantees parsing of grammar written using PEGs in linear time in spite of backtracking. The primary aim of the paper is to highlight the details of PEGs followed by various challenges existing for a better understanding of the readers. From the entire overview presented, it has been observed that PEGs address the issue of undesired ambiguity in grammar for computer-oriented programming language, by not allowing any ambiguity in rules itself at the first place. However, the guarantee of linear time execution comes with a cost of large heap consumption, making it infeasible to implement for large inputs. Optimizing the resources required for memoization, may allow us to utilize the benefits offered by PEGs.