
Go up to Top
Go forward to Prerequisites
Introduction
The pragmatics of using Essence are slightly different from that of
using other parser or parser generation packages.
At the heart of parsing is, as usual, a context-free grammar. Essence
provides a new syntactic form
define-grammar which embeds a
language for attributed context-free grammars into Scheme. This is
different from other parser generation packages which either represent
a context-free grammar as an S-expression object or in some special
syntax in a special file.
Given a grammar, parsing can proceed in one of two modes:
- A general parse procedure will accept a grammar, a
parsing method (SLR or LR), a lookahead size, and an input, and
produce the result of parsing and attribute evaluation. This mode
of operation allows instant turnaround, but also parses very
slowly. It is good for incremental development, but impractical for
production parsers.
- A parser generator (automatically generated from the
implementation of parse) produces a specialized parser
from a grammar, a parsing method, and a lookahead. The specialized
parser only accepts an input as an argument, but is otherwise
identical in operation to the general parser. It is highly
efficient, and therefore good for production use.
Mike
Sperber, Peter Thiemann
