headerphoto

ABNF Parser Generator

anbncn

This is the classic, textbook example of a simple language that cannot be described with a context-free-grammar. This example illustrates how syntactic predicates can extend a parser beyond the bounds of context-free parsing. It is an adaptation of the grammar found in the Wikipedia PEG article.

ABNF Grammar:   X

anbncn Input

To see a demonstration of how this grammar works:

  • Click Generate above
  • Click Configure
  • Check "Save Parser Trace"
  • Under "Traced Operators" check PRD then Save
  • Click Parse
  • Click "Display Trace" and "Full Screen"
Input String:   X

Parser Output: