Question
In this part of the assignment, you will learn to program with processes. The purpose of this part is to program a shell for your
In this part of the assignment, you will learn to program with processes.
The purpose of this part is to program a shell for your translator. The shell is a process that will run constantly until termination of the program through the command exit. The shell issues its prompt: Translator> and waits for a command. When a command is issued in the shell, the shell executes the procedure associated with the command. Your shell is a very simple one that can take 5 commands: trans_ES, trans_SE, trans_EF, trans_FE, exit. When one of the first four commands is entered by the user, the shell reads that command and creates a new process that executes the corresponding function (already written in Part I of the assignment). This new process runs while the process running the shell waits. When the function terminates, the process terminates too. Upon receiving the exit signal, the shell process breaks out of its waiting loop and reads the new command. If the shell reads the command exit, the program is terminated. You will need to use the following system calls: fork(), wait(), exec() (or another function from the exec() family) , exit().
Example of a run: Translator> trans_SE tigre tiger Translator> trans_EF mouse souris Translator> exit
Part I (due February 5) 34% In this part, you will be learning to program in Cby writing a simple program that implements a translation tool that translates words from English to Spanish and Spanish to English; or from English to French and French to English, using the two bilingual dictionaries shown below. English Cat Dog Bird Mouse Cow Tiger Horse Monkey Spanish Gato Perro Pajaro Raton Vaca Tigre Caballo Mono English Cat Dog Bird Mouse Cow Tiger | Horse Monkey French Chat Chien Oiseau Souris Vache Tigre Cheval SingeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started