Top 1,000 Features Creators Events Podcasts Extensions Blog Explorer CSV Download

PEG

< >

PEG, aka parsing expression grammar, is a grammar language created in 2002.

#835on PLDB 22Years Old

In computer science, a parsing expression grammar, or PEG, is a type of analytic formal grammar, i.e. it describes a formal language in terms of a set of rules for recognizing strings in the language. The formalism was introduced by Bryan Ford in 2004 and is closely related to the family of top-down parsing languages introduced in the early 1970s. Read more on Wikipedia...


Example from the web:
Expr โ† Sum Sum โ† Product (('+' / '-') Product)* Product โ† Value (('*' / '/') Value)* Value โ† [0-9]+ / '(' Expr ')'
Example from Wikipedia:
Value โ† [0-9.]+ / '(' Expr ')' Product โ† Expr (('*' / '/') Expr)* Sum โ† Expr (('+' / '-') Expr)* Expr โ† Product / Sum / Value

Language features

Feature Supported Example Token
Comments โœ“
Line Comments โœ“

View source

- Build the next great programming language ยท About ยท Resources ยท Acknowledgements ยท Part of the World Wide Scroll