| |
Examples of Generated Parsers
Lambda Prolog Parser - One of my big projects under
Dr. Miller has been the creation of a parser for Lambda Prolog
itself using LambdaYacc. It should be able to handle any Lambda Prolog files. The
parser will parse accumulated signatures and modules within an LP
program as well. To parse a Lambda Prolog program, use parselp
"<Name of Program>" A.
| lpgram.sig |
Defines types for grammar and other predicates needed for parsing |
| lpgram.mod |
Defines the grammar itself, associativity, and predicates to fully
parse a .sig and .mod file together |
| lpparser.sig |
The signature for the LP parser generated by LambdaYacc |
| lpparser.mod |
The generated module file for the parser |
| lpparser.tar.gz |
ALL files for the Lambda Prolog parser, including the .lp files |
Twelf Parser - The second large parser on which I worked
this semester was one for Twelf. Twelf is an interesting
language to parse within the confines of the BRC(1,1) grammar used by
LambdaYacc. There are a few little issues with using the Twelf
parser, namely:
- In
%mode declarations, one must put a space between
the "+", "-", or "*" and the
name of the variable. For instance, what would normally be
%mode eval +E -V in Twelf must be written as %mode
eval + E - V.
- Numbers cannot be used as names for declarations
Otherwise, it is able to parse all parts of a Twelf file.
| twelf.sig |
Defines types for grammar needed for parsing |
| twelf.mod |
Defines the grammar itself, associativity, etc. |
| twelfpar.sig |
The signature for the Twelf parser generated by LambdaYacc |
| twelfpar.mod |
The generated module file for the parser |
| twelf.tar.gz |
ALL files for the Twelf parser, including the .lp files |
More Examples - These first examples come from the original LambdaYacc page, although
they have been modified to fit with the new syntax of grammar
files.
"On-line" Calculator
| calcgrammar.sig |
Defines types for grammar and other predicates needed for evaluation |
| calcgrammar.mod |
Defines the grammar itself, as well as associativity and
evaluation |
| calculator.sig |
The signature for the calculator generated by LambdaYacc |
| calculator.mod |
The generated module file for the calculator |
| calc.tar.gz |
ALL files for the calculator, including the .lp files |
lpBasic experimental imperative language
| lpbasicgram.sig |
Defines types for grammar and other predicates needed for evaluation |
| lpbasicgram.mod |
Defines the grammar itself, as well as associativity and
evaluation |
| lpbasic_absyn.sig |
Sig file for the language's higher order abstract syntax |
| lpbasic_absyn.mod |
Mod file for the language's higher order abstract syntax |
| lpbaspar.sig |
The signature for the parser generated by LambdaYacc |
| lpbaspar.mod |
The generated module file for the lpBasic parser (and
interpreter) |
| itest1.lb |
Example file that can be run in the generated parser with run "itest1.lb".
| | lpbasic.tar.gz |
ALL files for lpBasic, including the .lp files |
"foldn" meta-logic embedded in lambda Prolog
|