Penguin

This is a language to define the formal grammar of a language, whether that be a ProgrammingLanguage, a MarkupLanguage or simply the syntax of a configuration file.

An example grammar would be

<sentance> ::= <verb-part> <noun-part>

<verb-part> ::= <noun-part> <verb>

<noun-part> ::= <proper-noun>

| THE <noun>

<verb> ::= throws

| kicks | hides | fetches

<proper-noun> ::= John

| Jane

<noun> ::= ball

::= dog

This grammar accepts sentances such as

  • Jane throws the ball
  • The dog fetches the ball
  • John kicks the dog
  • John hides Jane
  • The ball fetches Jane

but would not accept sentences such as

  • John deflates the ball
  • Jane hides in the basement

because deflates is not a verb known in this grammer and in the basement is not a noun. The grammar would have to be extended to cover such cases.

Because some common cases are inconvenient to define using pure BNF, some extensions have been added in EBNF:

  • ... means 1 or more
  • [? means optional