headerphoto

Examples

Each time I have written a new version of APG I have tried to include examples that show how to set up a parser and use the features. In many cases I have included a number of other examples for various other reasons. Some grammars have been chosen because they are "classics" - grammars that you see in the text books. SIP and MEGAGO grammars are widely used in the telecommunications business and have often been chosen as examples of substantial grammars of commercial importance. Other times grammars have been chosen simply out of curiosity.

See the individual projects for the latest examples provided. They may change from time to time and be different from what is listed here. But the following lists will give you an idea of what to find where.

APG Version 6.3

GitHub Repository

  • Demo - a simple grammar used to demonstrate most of the 6.3 features.
  • CppDemo - a trivial grammar to show how to set up and use a C++ parser.
  • MEGACO - demonstrates construction of an AST, its translation and it XML format.
  • SIP - an extensive timing test showing the power of UDTs for speed.
  • WideCharacters - 6.3 introduces for the first time variable integer sizes for the input string character codes. This example demonstrates use of 32-bit wide character codes.

Java APG Version 1.0

GitHub Repository

  • anbn
  • anbncn
  • demo
  • expressions
  • inifile
  • mailbox
  • testudtlib

JavaScript APG, Version 2.0

npm Repository

GitHub Repositories

JavaScript APG, Version 1.0

GitHub Repository
Interactive APG Right here!

  • anbn
  • anbncn
  • demo
  • Expressions
  • Initialization File
  • Dangling Else
  • UTF-8
  • Expressions
  • IPv6
  • e-mail address
  • URI
  • SDP
  • SIP
  • MEGACO
  • C++ Preprocessor