Lambda Prolog Parser Generator Page
This page describes a parser generator written with the Teyjus implementation
of Lambda Prolog (version 1.0-b27). There is a
corresponding research paper. Some
additional notes on the theory and implementation of the parser generator are also availble. These notes are informal and may change.
The associated web page on the higher order compilation project contains further examples.
Kamal Aboul-Hosn has made several
improvements to the parser generator. Link
I plan to write a set of user instructions soon. For now, if you are
interested in using the system, the best thing to do is to read my
research paper, the additional notes, and follow the format of the
calculator example and the "lpbasic" example. To create a parser,
"tjsim" the grammar module, then use - genparser "sbrc" grammar_module
parser_module - . For example, the online calculator was created by
- 'genparser "sbrc" "calcgrammar" "calculator".' -.
The Teyjus files are organized as follows:
- The parser generator code (including lexical analyzer):
- lambdayacc.sig
- lambdayacc.mod
- The classic "on-line calculator" example:
- Signiture file: defines types for grammar symbols and other additional predicates and terms needed for semantic action.
- Module file: defines grammar, operator associativity and precedence declarations, tokenizer keywords, semantic action clauses, etc...
- The generated parser itself (!) It will
"accumulate" the above modules. To use the parser, compile it and query it
with "parseline S." or "parsefile filename S". Files must (currently) end in
a dollar sign.
- The generated signature file - nothing
here except the accumulation of other signatures.
- The lpBasic experimental imperitive language (soon to be expanded)
- Signature, and module for the definition of the language's higher order abstract syntax, type checking, and interpretation in
lambda Prolog.
- Signature, and module for the grammar and semantic action specification - this grammar carries
simply typed lambda terms as attributes for let-expressions (hence
"higher order" abstract syntax).
- Signature, and module of the the generated parser.
- A small lpBasic program. Run it with 'run "itest1.lb"' after compiling and querying the generated parser.
- Allow me to be less specific now: (contact me for full code)
- Grammar and
generated parser files for the "foldn" meta-logic embedded in lambda Prolog. Since the concrete syntax of this language was chosen to match that
of lambda Prolog itself, this parser can also parse most of lambda Prolog
syntax. This parser was used at the Pennsylvania
State University to develop an interactive theorem prover.
- Grammar for core SML (sml without
modules) - still working on this one; no attributes or actions yet.
- Some small but interesting grammars for experimentation.
Please contact Chuck Liang at chuck.c.liang@hofstra.edu for questions.