Assignment 6: A Special-Purpose Language

Implementing Programming Languages, 2012
Aarne Ranta (aarne (at) chalmers.se)

Summary

The objective of this assignment is to design and implement a query language. The language should cover an adequate set of queries in some domain. The implementation should parse queries and return answers. The solution should include complete source code and documentation, which includes a human-readable grammar, a user manual, and a Makefile for compiling the system.

The syntax can resemble a formal or a natural language, e.g. SQL or English. The implementation can use BNFC or GF. Also an embedded language is allowed, but the host language tools (such as a Haskell interpreter) must be hidden from the user. The expected size of the language is 50--100 abstract syntax rules, thus about three times the size of the language in the book, Section 8.10. It should cover infinitely many different queries. The answering engine can be a database, a web service, or a program such as a mathematical problem solver.

Functionality

The language should be usable as a shell program, with the following syntax of interaction:

    $ query "<QUERY-IN-THE-LANGUAGE>"
    <ANSWER-TO-THE-QUERY>

You are also welcome to deliver it as a web application. But the shell program is needed for testing purposes, because it can easily be scripted.

Reporting

Your solution must contain the following parts:

You can assume the availability of all the tools called by BNFC, such as parser generators and compilers; these tools should not be included in the submission.