========= 1. From: https://en.wikipedia.org/wiki/Recursive_descent_parser The following EBNF-like grammar for Niklaus Wirth's PL/0 programming language: program = block "." . block = ["const" ident "=" num {"," ident "=" num} ";"] ["var" ident {"," ident} ";"] {"procedure" ident ";" block ";"} statement . statement = ident ":=" expression | "call" ident | "begin" statement {";" statement } "end" | "if" condition "then" statement | "while" condition "do" statement . condition = "odd" expression | expression ("="|"#"|"<"|"<="|">"|">=") expression . expression = ["+"|"-"] term {("+"|"-") term} . term = factor {("*"|"/") factor} . factor = ident | number | "(" expression ")" . Terminals are expressed in quotes. Each nonterminal is defined by a rule in the grammar, except for ident and number, which are assumed to be implicitly defined. ========= 2. An Extended-BNF grammar for mathematical expression bnf001.png From: Sahereh Hosseinpour, Mir Mohammad Reza Alavi Milani, Hüseyin Pehlivan A Step-by-Step Solution Methodology for Mathematical Expressions Symmetry 2018, 10, 285 p. 5 doi:10.3390/sym10070285 Published: 15 July 2018 https://www.mdpi.com/journal/symmetry ========= 3. A CFG grammar for quadratic equations bnf002.png From: Mir Mohammad Reza Alavi Milani, Sahereh Hosseinpour, Huseyin Pehlivan Rule-Based Production of Mathematical Expressions Mathematics 2018, 6, 254 p. 6 doi:10.3390/math6110254 Published: 15 November 2018 https://www.mdpi.com/journal/mathematics ========= 4. Derivations and syntax trees - przykład wyprowadzenia. W szczególności zwracamy uwagę na fragment: A derivation of a string for a grammar is a sequence of grammar rule applications that transform the start symbol into the string. A derivation proves that the string belongs to the grammar's language. A derivation is fully determined by giving, for each step: - the rule applied in that step, - the occurrence of its left-hand side to which it is applied. For clarity, the intermediate string is usually given as well.