| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Most useful interaction with a UNIX system occurs through the shell. Using a series of easy to remember and simple commands, one can navigate the UNIX file system and issue commands to perform a wide variety of tasks. Even though it may appear simple, the shell encapsulates many significant components of the operating system.
This project aims to create a command line interface that provides almost every functionality provided by the BASH and look forward to implementing minute tweaks and quick fixes that can influence its performance in terms of memory utilization, execution time and error handling. Moreover, the implementation methods make use of new styles and libraries. This includes implementation of concepts of Compiler Design (lexical analysis, syntax analysis, error handling) amalgamated with the concepts of process creation and control in Unix Systems. The project aims to make the shell more memory-efficient by making use of C++ Boost:: Filesystem Library that enables Directory Traversal and implementation of Change Directory command (cd) in the Unix Environment. Also, a new method of constructing SLR (1) parsing table has been improvised, this reduces the wastage of memory caused using conventional Sparse Matrix Method. Hence, the newly developed shell has been named BISHOP (Boost Implemented OPerational SHell).
The shell maintains many variables which allow the user to maintain settings and easily navigate the filesystem. Two of these that are particularly important are the current working directory and the PATH. As its name implies, the current working directory variable keeps track of the user's current directory. The kernel searches in the directories specified by the PATH variable starting with the leftmost directory first. Bishop’s environment uses Boost filesystem Library to check the user’s pwd (Present Working Directory) and execute cd (change Directory) command effectively. Also, the program code makes use of C’s readline library for text completion functionalities originally provided in the BASH.
Bishop parses the user input command by performing SLR (1) syntax analysis. The LR (k)-method uses two tables, which describe the behavior of a push-down automaton, used during the parsing process. These two tables, called action table and goto table, are sparse tables. Moreover, the data in them are not homogeneous in structure since both item numbers and right sides of productions are stored. I referred a paper which proposes: a new parsing table structure, which is dense and homogeneous; a parsing algorithm; and an algorithm for generation of this table, based on the SLR (1)-method.
The proposed parsing table structure has 4 attributes:
UNIX provides a variety of useful programs for use (grep, ls, echo, to name a few).
Like instructions in C++, these programs tend to be quite effective at doing one specific thing
(Such as grep: searching text, ls: printing directories, and echo: printing text to the console).
However, programmers/OS users would like to accomplish large tasks consisting of many individual
operations. Doing such requires using results from previous steps in order to complete a larger
problem. Bishop supports this through the pipe operation (represented by the character |) just
like the BASH using Unix System calls (dup2(int oldfd, int newfd)).
A pipe in between two commands causes the standard output of one to be redirected into the standard
input of another. An example of this is provided below, using the pipe operation to search for all
processes with the name under root user:
ps auxx | grep “root”
Bishop uses the conventional methods of process creation and execution in Unix/Linux (fork () and execvp () system calls) aided by different implementation techniques like C++ STL (Standard Template Library) classes: std::string and std::vector.
For more information about fork, see its manpage by calling man 2 fork.
Bishop uses execvp (const char *file, char *const argv[]) system call as it maintains a vector of command input strings.
| Back | FazBrowse Home | New Git URL |