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:

  1. The parser generator code (including lexical analyzer):
    1. lambdayacc.sig
    2. lambdayacc.mod
  2. The classic "on-line calculator" example:
    1. Signiture file: defines types for grammar symbols and other additional predicates and terms needed for semantic action.
    2. Module file: defines grammar, operator associativity and precedence declarations, tokenizer keywords, semantic action clauses, etc...
    3. 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.
    4. The generated signature file - nothing here except the accumulation of other signatures.
  3. The lpBasic experimental imperitive language (soon to be expanded)
    1. Signature, and module for the definition of the language's higher order abstract syntax, type checking, and interpretation in lambda Prolog.
    2. 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).
    3. Signature, and module of the the generated parser.
    4. A small lpBasic program. Run it with 'run "itest1.lb"' after compiling and querying the generated parser.
  4. Allow me to be less specific now: (contact me for full code)
    1. 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.
    2. Grammar for core SML (sml without modules) - still working on this one; no attributes or actions yet.
    3. Some small but interesting grammars for experimentation.


Please contact Chuck Liang at chuck.c.liang@hofstra.edu for questions.