2023823 23:05 Programming Assignment 1 Programming Assignment 1
Due 1 Sep by 23:59 Points 200 Submitting an external tool Available 1 Aug at 9:00 5 Sep at 23:59
Assessment
Weighting:
20 200 Marks
Task description:
In this assignment, you will be writing a simple Regex engine that uses NFAs to match an input sequence.
Academic Integrity Checklist
Be careful
Code snippets from reference pagesguidesStack Overflow must be attributedreferenced.
Only use code snippets that do not significantly contribute to the exercise solution.
Submit code not solely authored by you. Postshare code on Piazzaonlineetc. Giveshow your code to others
Set your GitHub repository to Public
Discusscompare high level approaches
Discusscompare program outputerrors
Regularly commitpush your work and add commentsnotes on you commits
Before you begin
This assignment will be marked using a combination of automated and manual techniques. You must log your development progress
During manual marking, we will look at your development process. If we do not see a clear path to a solution
i.e. code changes and regular commits and comments on those commits reflecting your learning to develop your implementation
you may forfeit up to 100 marks.
https:myuni.adelaide.edu.aucourses85273assignments342965?moduleitemid3107411 19
2023823 23:05 Programming Assignment 1
An example case of forfeiting 100 marks would be the sudden appearance of working code with no prior evidence of your development process.
It is up to you to provide evidence of your development through regular commits and comments.
This assignment requires thought and planning. You need to start early to allow yourself time to think of what and how to test before modifying any code. Failing to do this is likely to make the assignment take far more time than it should.
IMPORTANT NOTE FROM NICK: We are using GitHub Classrooms for assignments in EDC. You must stage your code and commit it on a regular basis to ensure that we can see the evolution of your code over time. It must be down inside the repository that will be linked to GitHub classrooms as we can easily track your commit history and development through there. Using any other code revision system for submission or another type of GitHub account will automatically reduce your mark by at least 100 marks, for reasons listed above. Please, please, please, follow the instructions and make it easy for us to give you all the marks you deserve!
Apply EventDriven Techniques to an Input Stream.
Use FSAs NFAs, NFAs andor DFAs to evaluate the inputs against for a given Regular Expression.
In this assignment, you will be writing code to simulate a FSA based regular expression engine.
The system you develop will need to generate the FSA structures that match a given Regex dynamically and then evaluate several series of inputs against that FSA to determine whether they are a match.
This assignment requires you to apply concepts and techniques covered in Chapters 04 of the Notes on FSAs see course readings.
Youll also need to document and thoroughly test your code using unit tests to ensure robust event handling techniques are being used.
The system will need to:
1. Parse an basic regular expression from standard input
2. Generate a NFA to evaluate the regular expression
3. Evaluate the subsequent inputs against the regular expression.
https:myuni.adelaide.edu.aucourses85273assignments342965?moduleitemid3107411 29
2023823 23:05 Programming Assignment 1
Event Driven systems are particularly prone to errors so youll also need to:
1. Document your planning of the system See LoggingDocumenting your Progress below
2. Write your own suite of test cases for your code See Testing your Code below
Programming LanguageSoftware Requirements
Version Control System
Your work must be stored and submitted using GitHub Classroom:
follow these instructions https:myuni.adelaide.edu.aucourses85273pagessettingupgithubclassroom forassignment1 to set this up!
You will need to log your progress by commenting on your commits
Programming Language
You will need to use Java JUnit to complete this assignment.
Your code will be run using JDK 11. Why JDK 11 https:myuni.adelaide.edu.aucourses85273pageswhyjdk11 ? Your test code will be run using JUnit 4
If youre using package management and a container based approach, we are using the following packages
ONLY USE THIS IF YOU KNOW WHAT YOU ARE DOING:
apt y install openjdk11jdk junit4
Your implementation must not use any of the programming languages inbuilt regular expression parsingevaluation librariesclasses.
Your implementation may use any other librariesclasses available in the standard JDK and JUnit, but no other external librariesclasses.
Your programs will be executed with the commands shown below: Compiled with
javac RegexEngine.java
java RegexEngine
or for verbose mode
https:myuni.adelaide.edu.aucourses85273assignments342965?moduleitemid3107411 39
2023823 23:05 Programming Assignment 1
Tests compiled with:
javac Test.java
Each Test run with:
java org.junit.runner.JUnitCore TestNameTest
java RegexEngine v
Input Format
Your program will need to read input from the terminalcommand lines standard input System.in .
The expected input format is as follows:
1. The input begins with the regular expression to test.
In this assignment, a regular expression can consist of lower and upper case letters, numbers, spaces, the alternation operator , the Kleene star and Kleene plusoperators and ,aswellasbrackets and .
You are not expected to handle nested brackets.
Invalid input in this section should cause the program to print an error message and exit with an exit code of 1.
2. The next section of input contains the input strings to evaluate against the regular expression.
Each string is on its own line; when a new line is entered, another string begins dont forget to reset states
A string can be emptyblank.
A string can contain whitespace and other control characters.
3. This repeats until the program is terminated with a SIGTERM CtrlC.
Expected Output Format
The program has 2 output modes; a normal mode and verbose mode.
Verbose should trigger if the user adds a v when running the program see Software Requirements above
Under normal mode
After the user has entered the regex your program should print ready
https:myuni.adelaide.edu.aucourses85273assignments342965?moduleitemid3107411 49
2023823 23:05 Programming Assignment 1
Your program should then print true or once for each input string provided as they are entered.
If the input string matches the regular expression, print true If the input string does not match, print false
The input string should be evaluated for an exact match
i.e. the whole string from start to end must exactly match the regular expression to be accepted.
A string containing a match, but not exactly matching should print false .
Example user input is grey, output is highlighted pink
Under verbose mode
After the user has entered the regex your program should print a transition table for the NFA generated followed by the word ready
The transition table does not have to exactly match the example below, but does need to reflect the NFA generated by your system;
this is for manual review and your own debugging.
Your program should begin to print true or false as the user enters the input strings for each character input including the initial state,
If the system is currently in an accepting state, print true
Otherwise, print false
Hint: After a user has entered the input string the most recent output should match the normal output
Example user input is grey, output is highlighted pink
https:myuni.adelaide.edu.aucourses85273assignments342965?moduleitemid3107411 59
2023823 23:05 Programming Assignment 1
Submission, Assessment Marking
Submission
Before submitting
You will need to set up your GitHub Classroom repository using these instructions https:myuni.adelaide.edu.aucourses85273pagessettingupgithubclassroomfor assignment1 .
Be sure to set any repository you create for this assignment to private.
Your source files must either be in the root of your repository, or in a src folder To submit
1. Click the Load Programming Assignment … in a new window button at the bottom of this page
2. Select the Submit button on that page
3. When prompted, link your Github Classroom account account
4. Select the repository and branch that you want to submit probably main for most of
5. Submit and wait for the system to check your work.
Your submission will run through some acceptance tests and provide basic feedback. Full testing comes after the assignment deadline and will be done using a combination of automatic and manual tests.
Assessment
The assignment is marked out of 200. These 200 marks are allocated as follows using a combination of automated testing and manual review:
Basic Implementation 70 marks
The system can handle basic regular expressions consisting of single operations These regular expressions generate a reasonable NFA
Inputs are correctly evaluated against that NFA
More complex expressions 70 marks
The system can handle regular expressions consisting of multiple operations.
https:myuni.adelaide.edu.aucourses85273assignments342965?moduleitemid3107411 69
2023823 23:05 Programming Assignment 1
Order of operations is correctly handled.
These regular expressions generate a reasonable NFA Inputs are correctly evaluated against that NFA
Brackets and nested expressions 30 marks
The system can handle regular expressions containing brackets max 1 layer deep and chained operators.
Order of operations is correctly handled.
These regular expressions generate a reasonable NFA
Inputs are correctly evaluated against that NFA
Edge Cases 30 marks
The system is otherwise functional and correctly handles edge cases and erroneous input
However, your marks are scaled and reviewed based on the following:
1. Up to 10 marks may be deducted for poor code quality.
When in doubt, consider Googles Java Code Style Guide https:google.github.iostyleguidejavaguide.html . Javadoc comments are always recommended.
2. Up to 100 marks may be deducted for poor or missing testing.
Your test code will be reviewed against a code coverage checker. Poor test coverage will result in lost marks.
3. Up to 100 marks may be deducted for poorinsufficientmissing evidence of development process.
LoggingDocumenting your Progress
Well be using GitHub Classroom to log your development progress this semester.
Each time you make a commit and push those changes, they will be visible in your commit history:
https:myuni.adelaide.edu.aucourses85273assignments342965?moduleitemid3107411 79
2023823 23:05 Programming Assignment 1
Each commit can have additional notes and comments added to it:
Testing your Code
Well be using JUnit to test our code
Take a look at their Getting Started guide: https:github.comjunit
teamjunit4wikiGettingstarted https:github.comjunitteamjunit4wikiGettingstarted
You will be reviewed on your test coverage, which will be done using a combination of manual review and automated test coverage reports.
This tool needs to be loaded in a new browser window
Load Programming Assignment 1 in a new window
https:myuni.adelaide.edu.aucourses85273assignments342965?moduleitemid3107411 89
2023823 23:05 Programming Assignment 1
https:myuni.adelaide.edu.aucourses85273assignments342965?moduleitemid3107411 99