Nothing Special   »   [go: up one dir, main page]

Skip to content
Grégoire Détrez edited this page Sep 9, 2013 · 1 revision

LBNF Pragmas

Entry point pragmas

entrypoints (Ident ",")* Ident ;

This indicates which non-terminal (or non-terminals, see bellow) is used as the goal for parsing. If no entry point is explicitly declared, the non-terminal on the left hand side of the first production will be used by default.

For some target languages (e.g. haskell), the BNF Converter generates, by default, a parser for every category in the grammar. This is unnecessarily rich in most cases, and makes the parser larger than needed. If the size of the parser becomes critical, the entry points pragma enables the user to define which of the parsers are actually exported:

For instance, the following pragma defines Stm and Exp to be the only entry points:

entrypoints Stm, Exp ;
Clone this wiki locally