Giter VIP home page Giter VIP logo

mnsh's Introduction

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.

mnsh's People

Contributors

rghouzra avatar yrhiba avatar

Stargazers

Assia avatar  avatar

mnsh's Issues

fixing not fork

Fixing Please!
Not fork when there is a builtin comand that is not relayted to Pipe.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.