【正文】
Digitale Informationsverarbeitung 1 9. Syntaxdiagramme und BackusNaurForm (BNF) Programmiersprachen h228。ufig definiert durch kontextfreie Grammatiken in BNF mit gewissen Zusatzbedingungen BNF statt A w1 | w2 | ... | wn A w1 A w2 ... A wn A x(y)z A xz A xyz A x{y}z A xz A xBz B yB B y Digitale Informationsverarbeitung 2 Symbol Bedeutung Beispiel = ist 228。quivalent zu A = B + C + Sequenz (impliziert keine Ordnung) X = X1 + X2 + X3 [ ? ] Auswahl (entweder ... oder) A = [B | C] { } Wiederholung A = { B } M{ }N Wiederholung von M bis N A = 1 { B } 10 ( ) Option = 0 { }1 A = B + ( C ) * * Kommentar A = X + Y * Kommentar * Digitale Informationsverarbeitung 3 WhileBerechenbarkeit Ein WhileProgramm besteht aus folgenden Komponenten: Variablen: x0, x1, x2, ... Konstanten: 0, 1, 2, ... Trennsymbole: 。 := Operationszeichen: + ? Schl252。sselw246。rter: WHILE DO END 1. Eine Wertzuweisung der Form xi := xj + c oder xi := xj c (c Konstante) ist ein WhileProgramm 2. Falls P1 und P2 WhileProgramme sind, so auch P1。P2 3. Falls P WhileProgramm ist, so ist auch WHILE xi ≠ 0 DO P END ein WhileProgramm 4. Nur die durch 13 beschiebenen Konstrukte sind WhileProgramme Syntax von WhileProgrammen, induktive Definition: Digitale Informationsverarbeitung 4 Beispiel WHILE x1 ≠ 0 DO x3 := x2。 WHILE x3 ≠ 0 DO x0 := x0 + 1。 x3 := x3 1 END。 x1 := x1 1 END Multiplikation: Eingabe: x1, x2, Ausgabe: