Due by 11:59.59pm Tuesday October 03 2017
Note: You may work with a partner on this project. The URL for this github repository is https://classroom.github.com/g/Y17hRrrj I'm experimenting with specifying this is a group repository. Please let me know if this does not work.
For this assignment create a program pig that will read in English text and translate it into Pig Latin. In particular you'll be working with strings in C.
Pig Latin is used by both adults and children to obfuscate what they are saying from the other. Some of you might have toyed around with the language yourself as a child.
For this assignment, you'll be creating two programs: pig and unpig. pig will read in English text and convert it into pig latin. unpig will do the opposite and will take in text in Pig Latin and convert it back to English. Note: Untranslating pig latin is not deterministic, if you start with English and translate via these rules, undoing them will not get you the original. That is fine. Just follow the rules as stated.
There are a couple of varying rules to Pig Latin. For this assignment, we'll be using the following:
Rule 1:If the string begins with a vowel (that is begins with 'a', 'e', 'i', 'o', or 'u') add "yay" to the end of the string.
Rule 2:Otherwise, find the first occurance of a vowel, then move all the letters before the vowel to the end of the word and add "ay".
Note:"y" should be considered a vowel in this context.
You can consider a word to be a consecutive sequence of letters (A-Z, a-z). "y" should be treated as a consonant if it is the first letter of the word but as a vowel otherwise.
In addition to modifying the words as specified above, your program should also respect the following rules:
Some dialects of pig latin say that you should move "silent" letters to the end as well (such as in the word knife). You can ignore contraction words (don't).
In general, the words will be translated as follows: Linux -> Inuxlay yes -> esyay example -> exampleyay
Some guidelines you should follow when working on your solution:
You'll want to think about how to breaks this program into its component parts.
Additionally, I'd like you to implement a -h and -? flag that prints out a brief usage message and exits the program with a non-zero value. You should do the same if an unknown flag is passed to the program.
You should have your program's main function return 0 upon successful completion of the assigned task.
You'll also be creating a man page to accompany your tool. Man pages are simply text files that have some additional annotations with formatting instructions -- somewhat similar to LaTeX if you've encountered that as well.
Traditionally, the tool nroff was used to do typesetting of man pages. These days, many systems now have groff and just have nroff as an alias to groff. You can get more info on the various options by seeing the manpage groff_man(7).
At a minimum, you will need to know the following macros (all go at the start of the line).
.\" Sample man page for CSCI 241 .\" Roberto Hoyle - Spring 2017 .TH sample_man 1 "05 March 2017" "CSCI 241" "Oberlin College" .SH NAME .B sample_man \- an example of a sample man page .SH SYNOPSIS .B sample_man [ -o outputfile ] <filename> .SH DESCRIPTION Does everything a sample man page should do. .SH OPTIONS .IP "-o outputfile" Do things to be written to an output file. .SH AUTHOR Roberto Hoyle (Spring 2017) .SH BUGS None!
You can also see/download a longer version.
You should name your file based on the standard convention <name_of_program>.<manual_section>. So for the above page, it would be sample_man_page.1. (Recall that section 1 is user commands.)
To view the processed man page use either of the following commands:
Here is the HTML version of above:
sample_man(1) Oberlin College sample_man(1) NAME sample_man - an example of a sample man page SYNOPSIS sample_man [ -o outputfile ] <filenames> DESCRIPTION Does everything a sample man page should do. OPTIONS -o outputfile Do things to be written to an output file. AUTHOR Roberto Hoyle (Spring 2017) BUGS None! CSCI 241 05 March 2017 sample_man(1)
Create a file called README that contains
Now you should make clean to get rid of your executables and handin your folder containing your source files, Makefile, and README through GitHub
% git add % git commit % git push
Remember, if you have issues with commits due to odd merges, it is easier to start over, clone into a new directory, and copy the files over before commiting and pushing.
In addition, if you are working with a partner, you should do git pull periodically to pull their changes into your direction to avoid having to do a merge
It is now time to start thinking about your final project teams. Send me an email with a list of people that you would like to team up with, and a list of people that you would not like to be teamed up with. If I do not get an mail from you, I will assume you have no preferences and will be happy with any team assignment that I make.
Please put a subject on the message starting with [cs241-team].
Here is what I am looking for in this assignment: