ebnf:examples
Inhaltsverzeichnis
EBNF Examples
Arithmetic Expressions
<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>
Designator
<ebnf> "Designator" {
Designator = (ident | "this" | "super") {"." ident | "[" Expr "]"}.
} </ebnf>
Backus-Naur Form (BNF)
<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
ebnf/examples.txt · Zuletzt geändert: von 127.0.0.1
