Week 13 Practical Exam Demo
Due 11 Jun by 10:00 Points 100
Available 11 Jun at 9:00 – 11 Jun at 12:00 about 3 hours
Demonstration Exam
This exam is a demonstration of what the Week 13 Practical Exam (https://myuni.adelaide.edu.au/courses/54310/pages/week-13-practical-exam-intro) will look like except that,
• any marks reported by the web submission system will not be used, • the grammar rules to be parsed are different, and
• the startup files are different.
Exam Setup
1. Create a directory in your svn repository named: 2020/s1/cs/exam3p 2. Check out a working copy of the new directory.
3. Download the startup files, using the link at the end of this page, and copy them into the working copy.
4. svn add the parser.cpp file to your svn repository and perform an svn commit. svn add parser.cpp
svn commit -m exam3
5.Make a submission to the web submission system (https://cs.adelaide.edu.au/services/websubmission) assignment named: Practical Exam 3 / Demo Exam
Exam Description
You will be required to write a C++ implementation of a recursive descent parser for a simple language. Each of the functions will be tested independently by the web submission system. During the exam you will be required to use the have() function to choose between alternatives rather than switch statements. Also, you will be required to use the mustbe() function rather than the next_token() function to advance the input. A summary of the grammar, tokens and a list of functions you are permitted to use will be listed in
the parser.cpp file that you will be required to edit. The grammar and tokens are also described in the file includes/parser.h.
All the parsing functions that you implement are named as student_parse_*() with a matching parse_*() function provided by the precompiled library. For example, the function to parse the return statement described by the grammar rule Return, must be implemented by completing the function student_parse_Return() but if you need to call this function you must instead call parse_Return(). This arrangement allows the test scripts the ability to selectively replace your parsing functions with its own versions that work. In turn, this allows each of your parsing functions to be independently tested. As a result you are free to implement your parsing functions in any order your wish.
Testing
The startup files have the same structure as used in the workshops and programming assignments. If you wish to test your implementations without making a web submission, you can simply run the command:
% make
| Parser | Diff | Test Result
” ./parser | bin/diffc – tests/while-statement.passed ” test failed
Initially the startup files contain a single test output that tests your implementation of the exam grammar using correct input. To see where your implementation is failing you can use the commands shown between ” ” in the output of make to see the relevant error messages.
When you make a web submission, the test script will also check each of your parsing functions using some incorrect input to see if the correct errors are generated.
Note: You have only been given a single test example. If your program passes this test it does not mean that it is correct. It only means that it appears to work with the single test case on your computer. If the example passes on your computer but fails on the web submission system, you have a bug in your program that you need to fix. Remember that the order in which function arguments and operands in expressions are evaluated can differ from one C++ compiler to the next. If your program fails in this way it is incorrect.
Marks
There are a total of 12 tests run the web submission system’s test script each of which is given a mark of 0 or 4.
Frequent Web Submissions
Remember to make frequent submissions to the web submission system
• late submissions receive a mark of 0, so
• make a web submission as you complete each parsing function.
Startup Files
The startup files in the attached zip file should work on most 64-bit Linux systems and on a Mac. Please see the Startup Files for Workshops and Assignments (https://myuni.adelaide.edu.au/courses/54310/pages/startup-files-for-workshops-and- assignments) page for more information.
• exam-parser-px-pr.zip (https://myuni.adelaide.edu.au/courses/54310/files/6502383/download?wrap=1)
(https://myuni.adelaide.edu.au/courses/54310/files/6502382/download?wrap=1)