Translational Backus–Naur form

Translational Backus–Naur Form (TBNF or Translational BNF) refers to Backus–Naur form, which is a formal grammar notation used to define the syntax of computer languages, such as Algol, Ada, C++, COBOL, Fortran, Java, Perl, Python, and many others. TBNF goes beyond BNF and extended BNF (EBNF) grammar notation because it not only defines the syntax of a language, but also defines the structure of the abstract syntax tree (AST) to be created in memory and the output intermediate code to be generated. Thus TBNF defines the complete translation process from input source code to intermediate code. Specification of the output intermediate code is optional, in which case you will still get automatic AST creation and have the ability to define its structure in the grammar.

Overview
The TBNF concept was first published in April 2006 in a paper at SIGPLAN Notices, a special interest group of the ACM.

Here is a sample grammar specified in TBNF:

Given this input:

Running the translator generated from the above grammar would produce this output: