A translational BNF grammar notation (TBNF)

  • Authors:
  • Paul B Mann

  • Affiliations:
  • Parsetec, St. Marys, KS

  • Venue:
  • ACM SIGPLAN Notices
  • Year:
  • 2006

Quantified Score

Hi-index 0.00

Visualization

Abstract

BNF grammar notation came into existence about 1960 for the specification of programming languages. It was first used for the automatic generation of parsers about 1972. BNF was later replaced with EBNF offering regular expression notation in the right side of grammar rules. EBNF is powerful, however, it describes only the recognition phase, which is only 1/3 of the process of language translation. The second phase is the construction of an abstract-syntax tree and the third phase is the creation of an instruction code sequence. Some parser generators automate the construction of an AST, but none, that I know of, automate the output of instruction codes. Certainly if these second and third phases are to be automated, a suitable notation is required in the grammar. This paper proposes a notation that permits the construction of the AST in the correct order and the creation of instruction codes. In effect, the complete translation process can be described in the grammar and correct translators generated automatically. A working system has been implemented and tested with good results. The generator is called LRgen and the new grammar notation is called TBNF.