Skip to content

rghouzra/mnsh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minishell (mnsh)

Minishell is a simple Bash executor and reader.

Overview

Minishell is a lightweight shell implementation inspired by Bash, designed to execute and interpret shell commands.

Process Flow

This flowchart provides an overview of both tokenization and parsing steps:

Minishell Flowchart

Implementation

To achieve Minishell's functionality, we follow these key steps:

  1. Tokenization: In general, we use Bash as a reference, particularly for splitting commands into tokens, handling whitespaces, and operators.

  2. 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 named treegraph.dot. You can visualize this tree using Graphviz or by installing the Graphviz extension if you're using VS Code.
  3. Execution: The final step is traversing the AST recursively and evaluating whether each node represents an operator or a command.

Additional Resources

  • 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.

About

MiniShell, it's like bash simple executor and reader.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published