Coding Assignment
Project 1
This project involves writing a program that parses, using recursive descent, a GUI
definition language defined in an input file and generates the GUI that it defines. The
grammar for this language is defined below:
gui ::=
Window STRING '(' NUMBER ',' NUMBER ')' layout widgets End '.'
layout ::=
Layout layout_type ':'
layout_type ::=
Flow |
Grid '(' NUMBER ',' NUMBER [',' NUMBER ',' NUMBER] ')'
widgets ::=
widget widgets |
widget
widget ::=
Button STRING ';' |
Group radio_buttons End ';' |
Label STRING ';' |
Panel layout widgets End ';' |
Textfield NUMBER ';'
radio_buttons ::=
radio_button radio_buttons |
radio_button
radio_button ::=
Radio STRING ';'
In the above grammar, the red symbols are nonterminals, the blue symbols are tokens
and the black punctuation symbols are BNF metasymbols. Among the tokens those in
title case are keywords. The character literals are punctuation tokens.
Below is an explanation of the meaning of some of the symbols in the above
productions that should help you understand the actions that are to be performed when
each of the productions is parsed:
In the window production the string is name that is to appear in the top border of
the window and the two numbers are the width and height of the window
In the production for layout_type that define the grid layout, the first two
numbers represent the number of rows and columns, and the optional next two
the horizontal and vertical gaps
In the production for widget that defines a button, the string is the name of the
button
In the production for widget that defines a label, the string is text that is to be
placed in the label
In the production for widget that defines a text field, the number is the width of
the text field
In the production for radio_button, the string is the label of the button
You parser should properly handle the fact that panels can be nested in other panels.
Recursive productions must be implemented using recursion. Syntactically incorrect
input files should detect and report the first error.
Below is an example of an input file:
Window "Calculator" (200, 200) Layout Flow:
Textfield 20;
Panel Layout Grid(4, 3, 5, 5):
Button "7";
Button "8";
Button "9";
Button "4";
Button "5";
Button "6";
Button "1";
Button "2";
Button "3";
Label "";
Button "0";
End;
End.
The above input file should produce the GUI shown below:
You may use any programming language of your choice, examples are Java, or C++, or C# etc.
Deliverables:
Deliverables for this project include the following sections. Label the section appropriately, as
noted below.
Section 1- Approach
Write up, or explanation on your approach. Write a paragraph, or two on this.
Section 2- Assumptions
Write up, or explanation on any assumption that you have made. Write a paragraph, or two on
this. If you have not made any assumption, you may keep this section empty.
Section 3- Not Implemented
Write up, or explanation on functions that you were not able to implement. Explain challenges
faced, and effort you made to resolve it. Write a paragraph, or two on this. Consider this your
way to defend yourself and explain the effort made. If you have implemented all the functions,
then keep this section empty.
Section 4 – lessons Learned
Write up on what lessons you have learned. Write a paragraph, or two on this.
Section 5- Possible Improvements
Write up on ways to improve your code. Improvement could be something you would have done
different, but was not able to do because the scope, or time did not permit, functions that you
were not able to implement and the reason for not doing, a different approach that you would
have taken a different way of solving the problem etc. Write a paragraph, or two on this.
Section 6 – Source Code
Include the source code that you have written. Copy and paste it in the MS Word document.
Section 7 – Test Plans
Write up on the test conditions (test plans) that you have tested. Include the positive test
(conditions that pass the program), and negative test (conditions that will make the program not
perform), explain those scenarios.
Section 8 – Test Runs with Screen Shot
Include screen shots of user interfaces generated while you tested the program. For example,
when you run the program, you will receive GUI output, or console output. Include screen shot
of each test run of the GUI output to support successful running of the program. Use these screen
shots to demonstrate that you have successfully run the program and tested it.
What to submit:
1. A single MS Word (or PDF) file including the answers for the above 8 sections.
In a single MS Word (or PDF) file, include the answers for the above 8 sections. Number
each section, as noted above. Name the MS Word (or PDF) document as
lastname_firstname_project1 and upload that single document in the submission
area.
2. Zip file with the source code
Upload a separate file (a zip file ) containing all your source code in the in a
single zip file. For example, if you wrote the code in Java, only include the .java
files, do not include .class files.
In other words, you will submit a single MS Word file, or a PDF (and yes, the document will
include the copy and paste of the source code, as that is one of the sections, which is Section 6),
and also a zip file with the actual source code. The course shell allows upload of multiple files,
which is one MS Word (or PDF) in this case, plus a zip file (containing the source code).
It may sound redundant for you to include the source code (copy and paste) ibn the document,
and also in the zip file. But please follow so.
You may use Jaca, C, C++, or C# as the programming language choice. If you are using Java,
you may use StringTokenizer clas. It is not mandatory that you use StringTokenizer, but that is an option, if you choose to use it. Radio buttons are just those calculator buttons with number 1, 2, 3 etc. Those numbers in calculator are defined as buttons. As a user would press a button, it will get displayed on the text box on the top. Understand that it is NOT a full blown implementation of a calculator in this project 1. Project 1 only lays out the foundation of the calculator. For that matter, we do not implement buttons as "Add", "Subtract" etc. in Project 1 yet. We leave them for project 2.
Grading Rubric: Your score may range between minimum and maximum for each attribute.
Grading Attribute Meets Does not meet
Functionality I will look at your documentation (containing copy and paste of code) and also the zip file (containing the source code) for this.
Maximum possible points: 40 Writes a program that parses an input file defining a GUI definition language using recursive descent. Properly handles the fact that panels can be nested in other panels. Implements recursive productions using recursion.
Minimum possible points: 0 Does not writes a program that parses an input file defining a GUI definition language using recursive descent. Does not properly handle the fact that panels can be nested in other panels.
Does not properly implement recursive productions using recursion.
Input I will look at your documentation and the source code for this.
Maximum possible points: 20 Syntactically incorrect input file should detect error.
Minimum possible points: 0 Syntactically incorrect input file does not detect the error.
Output I will look at your documentation and the source code for this.
Maximum possible points: 20 Generates the GUI and the test runs.
Minimum possible points: 0 Does not generate the GUI and the test runs.
Documentation I will look at your documentation for this.
Maximum possible points: 20 High quality of the documentation provided, including the 8 sections.
Minimum possible points: 0 Documentation is not provided.