Labelled BNF: a high-level formalism for defining well-behaved programming languages
Paper i proceeding, 2003
The grammar formalism Labelled BNF (LBNF) and the compiler construction tool BNF Converter are introduced. Given a grammar written in LBNF, the BNF Converter produces a complete compiler front end (up to, but excluding, type checking), i.e. a lexer, a parser, and an abstract syntax definition. Moreover, it produces a pretty-printer and a language specification in L A T E X, as well as a template file for the compiler back end. A language specification in LBNF is completely declarative and therefore portable. It reduces dramatically the effort of implementing a language. The price to pay is that the language must be "well-behaved", i.e. that its lexical structure must be describable by a regular expression and its syntax by a context-free grammar.