CS 315 - Fall 2017
Project 1


Assigned: Oct 13, 2017
Due: Oct 23, 2017, 23:59

Design and Lexical Analysis of a Propositional Logic Programming Language

This year's project is about the design of a new language for propositional calculus. This newly designed language will be similar to imperative languages with the main difference of only working with variables and expressions of logical type.

Part A - Language Design

First, you will give a name to your language and design its syntax. Note that the best way to hand in your design is its grammar in BNF form, followed by a description of each of your language components. The following is a list of features we require in your language:

You are encouraged to use your imagination to extend the list given above.

Do not panic! You will have a chance to do minor revisions on your syntax design for Project 2 (later in the semester). Language designs are almost never exactly right in the first iteration. Just try your best to make it as readable/writable/usable/reliable as you can and keep your eyes open for what does and what does not work :)

Part B - Lexical Analysis

In the second part of this project, you will design and implement a lexical analyzer for your language, using the lex tool available on all Unix style systems. Your scanner should read its input stream and output a sequence of tokens corresponding to the lexemes you will have defined in your language. Since at this stage you will not be able to connect the output to a parser, your scanner will print the names of the tokens on the screen. For instance, if we were designing a C like syntax, the input

if ( answer == 2 ) { ...

should have produced the output

IF LP IDENTIFIER EQUAL NUMBER RP LBRACE ...

Part C - Example Programs

Finally, you will have to write a test program of your choice that exercises all of the language constructs in your language, including the ones that you may have defined in addition to the required list above. Be creative, have some fun. Make sure your lex implementation correctly identifies all the tokens.

Do not panic! You are not required to write an interpreter or compiler for this language. Just write a few programs in the language you designed and make sure that the lexixal analyzer produces the right sequence of tokens.

Logistics

Submission:

Resources

Good Luck! - Have fun.