Minishell is a simple Bash executor and reader.
Minishell is a lightweight shell implementation inspired by Bash, designed to execute and interpret shell commands.
This flowchart provides an overview of both tokenization and parsing steps:
To achieve Minishell's functionality, we follow these key steps:
-
Tokenization: In general, we use Bash as a reference, particularly for splitting commands into tokens, handling whitespaces, and operators.
-
Parsing: We generate an abstract syntax tree (AST) using the Shunting Yard algorithm, which involves implementing our own stack and queue data structures.
- Shunting Yard Algorithm
- In the
srcs/utils/readinput.c
, there's a function that prints in the dot language format, producing a file namedtreegraph.dot
. You can visualize this tree using Graphviz or by installing the Graphviz extension if you're using VS Code.
-
Execution: The final step is traversing the AST recursively and evaluating whether each node represents an operator or a command.
- Linux Pipes: Learn more about handling pipes in Unix-like systems.
- Signals: Learn more about handling signals (SIGINT, SIGKILL).
- I/O Multiplexing: Learn about I/O operations.
- Clone the repository:
git clone git@github.com:rghouzra/mnsh.git
cd mnsh
- Compile the project:
mkdir build && cd build
cmake ..
make