encyclopegia.org

Wirth syntax notation

Wirth syntax notation (WSN) is a metasyntax, that is, a formal way to describe formal languages. Originally proposed by Niklaus Wirth in 1977 as an alternative to Backus–Naur form (BNF). It has several advantages over BNF in that it contains an explicit iteration construct, and it avoids the use of an explicit symbol for the empty string (such as or ε). WSN has been used in several international standards, starting with ISO 10303-21. It was also used to define the syntax of EXPRESS, the data modelling language of STEP.

Wirth syntax notation (WSN) is a metasyntax, that is, a formal way to describe formal languages. Originally proposed by Niklaus Wirth in 1977 as an alternative to Backus–Naur form (BNF). It has several advantages over BNF in that it contains an explicit iteration construct, and it avoids the use of an explicit symbol for the empty string (such as or ε). WSN has been used in several international standards, starting with ISO 10303-21. It was also used to define the syntax of EXPRESS, the data modelling language of STEP. SYNTAX = { PRODUCTION } . PRODUCTION = IDENTIFIER "=" EXPRESSION "." . EXPRESSION = TERM { "|" TERM } . TERM = FACTOR { FACTOR } . FACTOR = IDENTIFIER | LITERAL | "[" EXPRESSION "]" | "(" EXPRESSION ")" | "{" EXPRESSION "}" . IDENTIFIER = letter { letter } . LITERAL = """" character { character } """" . The equals sign indicates a production. The element on the left is defined to be the combination of elements on the right. A production is terminated by a full stop (period). Repetition is denoted by curly brackets, e.g., {a} stands for ε | a | aa | aaa | .... Optionality is expressed by square brackets, e.g., [a]b stands for ab | b. Parentheses serve for groupings, e.g., (a|b)c stands for ac | bc. We take these concepts for granted today, but they were novel and even controversial in 1977. Wirth later incorporated some of the concepts (with a different syntax and notation) into extended Backus–Naur form. Notice that letter and character are left undefined. This is because numeric characters (digits 0 to 9) may be included in both definitions or excluded from one, depending on the language being defined, e.g.: digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" . upper-case = "A" | "B" | … | "Y" | "Z" . lower-case = "a" | "b" | … | "y" | "z" . letter = upper-case | lower-case . If character goes on to include digit and other printable ASCII characters, then it diverges even more from letter , which one can assume does not include the digit characters or any of the special (non-alphanumeric) characters. syntax = rule [ syntax ] . rule = opt-whitespace " " opt-whitespace "::=" opt-whitespace expression line-end . opt-whitespace = { " " } . expression = list [ "|" expression ] . line-end = opt-whitespace EOL | line-end line-end . list = term [ opt-whitespace list ] . term = literal | " " . literal = """" text """" | "'" text "'" . This definition appears overcomplicated because the concept of "optional whitespace" must be explicitly defined in BNF, but it is implicit in WSN. Even in this example, text is left undefined, but it is assumed to mean " ASCII-character { ASCII-character } ". ( EOL is also left undefined.) Notice how the kludge " " has been used twice because text was not explicitly defined. One of the problems with BNF which this example illustrates is that by allowing both single-quote and double-quote characters to be used for a literal , there is an added potential for human error in attempting to create a machine-readable syntax. One of the concepts that migrated to later meta syntaxes was the idea that giving the user multiple choices made it harder to write parsers for grammars defined by the syntax, so computer languages in general have become more restrictive in how a quoted-literal is defined. ==Syntax diagram== Syntax diagram: ==References==

References

No reference rows published for this article.

Cite this article

MLA

"Wirth syntax notation." encyclopegia.org, 2026, https://encyclopegia.org/wiki/wirth-syntax-notation. Accessed 24 November 2026.

Chicago

"Wirth syntax notation." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/wirth-syntax-notation.

APA

encyclopegia.org. (2026). Wirth syntax notation. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/wirth-syntax-notation

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

1971 Memorial Cup

enwiki · references available

KOAN (AM)

enwiki · references available

The Short Life of José Antonio Gutierrez

enwiki · references available

1974 aluminum cent

enwiki · references available

Alan Judge (English footballer)

enwiki · references available

Buffalo Electric Vehicle Company

enwiki · references available

Anglesey Airport

enwiki · references available

Croatian Ice Hockey League

enwiki · references available

Mette Jacobsen

enwiki · references available

Kevin Victor Anderson

enwiki · references available

Feriköy S.K.

enwiki · references available

Ian Lougher

enwiki · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1377842689 · 0.5 · snapshot enwiki-001377842689

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.