December 2021
Beginner
840 pages
47h 29m
English
Extended Backus–Naur Form (EBNF) includes the following syntactic extensions to BNF.
Note that we have already encountered the extension to BNF for alternation (using |). Consider the following context-free grammar defined in BNF:
which can be used to derive the following sentences: x, (x, y, z), ((x)), and (((x)), ((y), (z))). We can reexpress this grammar in EBNF using alternation as follows:
We can express r2 more concisely using the extension for an optional item:
Read now
Unlock full access