This example grammar is similar to the Ebnf3.atg file provided with BB Coco. The main difference between Ebnf3.atg and this grammar is the addition of semantics to create a translator and pretty-printer.
An unattributed ATG grammar supplied as input to Coco will create a syntax-analyzer, assuming no errors have occurred. The output of Coco will be a scanner, parser and a main driver that will need to be compiled by BlackBox.
Such a syntax analyzer only accepts or rejects the input that the ATG grammar itself defines. The main driver will output (to the StdLog) the message "Parsed correctly" if there are no syntax errors in the input the ATG grammar expects. Otherwise the number of detected errors is output to the StdLog.
The input for sample runs are an EBNF definition for EBNF itself and an EBNF definition for Oberon. Errors are marked in the input focus view. All the previously discussed syntax-checking actions still occur. In addition, a pretty-printed version of the input grammar is output to a separate window.