Benutzer-Werkzeuge

Webseiten-Werkzeuge


ebnf:examples

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
ebnf:examples [2009/01/20 11:58] Vincent Tscherterebnf:examples [2011/05/30 12:29] (aktuell) – Externe Bearbeitung 127.0.0.1
Zeile 1: Zeile 1:
 +====== EBNF Examples ======
 +~~NOCACHE~~
 +===== Arithmetic Expressions =====
  
 +<code><ebnf> "Arithmetic Expressions" {
 +expression = term  { ("+" | "-") term} .
 +term       = factor  { ("*"|"/") factor} .
 +factor     = constant | variable | "("  expression  ")" .
 +variable   = "x" | "y" | "z" .
 +constant   = digit {digit} .
 +digit      = "0" | "1" | "..." | "9" .
 +} </ebnf></code>
 +
 +<ebnf> "Arithmetic Expressions" {
 +expression = term  { ("+" | "-") term} .
 +term       = factor  { ("*"|"/") factor} .
 +factor     = constant | variable | "("  expression  ")" .
 +variable   = "x" | "y" | "z" .
 +constant   = digit {digit} .
 +digit      = "0" | "1" | "..." | "9" .
 +}
 +</ebnf>
 +
 +See: http://en.wikipedia.org/wiki/Syntax_diagram
 +
 +===== Designator =====
 +<code><ebnf> "Designator" {
 +  Designator = (ident | "this" | "super") {"." ident | "[" Expr "]"}.
 +} </ebnf></code>
 +
 +<ebnf> "Designator" {
 +  Designator = (ident | "this" | "super") {"." ident | "[" Expr "]"}.
 +} </ebnf>
 +
 +See: http://dotnet.jku.at/applications/Visualizer/#Simple
 +
 +===== Backus-Naur Form (BNF) =====
 +<code>
 +<ebnf> "Backus-Naur Form" {
 +  syntax         = rule [ syntax ] .
 +  rule           = opt-ws  identifier opt-ws "::=" opt-ws expression opt-ws EOL .
 +  expression     = list [ "|" expression ] .
 +  line-end       = opt-ws EOL | line-end line-end .
 +  list           = term [ WHITESPACE list ] .
 +  term           = literal | identifier .
 +  identifier     = "<" character {character} ">" .
 +  literal        = "'" {character} "'" | '"'  {character} '"' .
 +  opt-ws         = { WHITESPACE } .
 +  character      = lowercase-char | uppercase-char | digit | special-char .
 +  lowercase-char = "a" | "b" | "..." | "z" .
 +  uppercase-char = "A" | "B" | "..." | "Z" .
 +  digit          = "0" | "1" | "..." | "2" .
 +  special-char   = "-" | "_" .
 +} </ebnf>
 +</code>
 +
 +
 +<ebnf> "Backus-Naur Form" {
 +  syntax         = rule [ syntax ] .
 +  rule           = opt-ws  identifier opt-ws "::=" opt-ws expression opt-ws EOL .
 +  expression     = list [ "|" expression ] .
 +  line-end       = opt-ws EOL | line-end line-end .
 +  list           = term [ WHITESPACE list ] .
 +  term           = literal | identifier .
 +  identifier     = "<" character {character} ">" .
 +  literal        = "'" {character} "'" | '"'  {character} '"' .
 +  opt-ws         = { WHITESPACE } .
 +  character      = lowercase-char | uppercase-char | digit | special-char .
 +  lowercase-char = "a" | "b" | "..." | "z" .
 +  uppercase-char = "A" | "B" | "..." | "Z" .
 +  digit          = "0" | "1" | "..." | "2" .
 +  special-char   = "-" | "_" .
 +} </ebnf>
 +
 +Adapted from: http://en.wikipedia.org/wiki/Wirth_syntax_notation

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki