Syntax Diagram - Example

Example

We use arithmetic expressions as an example. First we provide a simplified BNF grammar:

::= | "+" ::= | "*" ::= | | "(" ")" ::= "x" | "y" | "z" ::= | ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"

This grammar can also be expressed in EBNF:

expression = term, {"+", term}; term = factor, {"*", factor}; factor = constant | variable | "(", expression, ")"; variable = "x" | "y" | "z"; constant = digit, {digit}; digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";

One possible set of syntax diagrams for this grammar is:

Read more about this topic:  Syntax Diagram

Famous quotes containing the word example:

    Our intellect is not the most subtle, the most powerful, the most appropriate, instrument for revealing the truth. It is life that, little by little, example by example, permits us to see that what is most important to our heart, or to our mind, is learned not by reasoning but through other agencies. Then it is that the intellect, observing their superiority, abdicates its control to them upon reasoned grounds and agrees to become their collaborator and lackey.
    Marcel Proust (1871–1922)