Skip to content

[Milestone] minishell v1.0.0 Core Launch 🚀 #1

Description

@shonakam

🎯 Mission

Implement and integrate a robust shell environment following the GNU Bash execution model. This milestone covers the end-to-end lifecycle of a command: from interactive input (Readline) and lexical/syntactic analysis (Lexer/Parser) to process orchestration (Executor) and internal state management (Session/Builtins).

🏗 System Architecture

  • Session: Context initialization, Environment management, Signal handling.
  • Lexer: FSM-based tokenization, Operator & Word recognition.
  • Parser: Recursive descent parsing, AST construction (Pipeline, Logical, Subshell).
  • Executor: Process orchestration, Redirection, Word expansion, Job control.
  • Builtins: All mandatory internal commands with POSIX compliance.
  • Readline: Interactive CLI, History management, Signal-safe prompt.

🚀 Execution Flow (The Lifecycle)

Input → Lexer → Parser → Expander → Redirector → Executor → Wait & Cleanup

🔭 Scope (Target Features)

Syntax & Operators

  • Pipelines: Parallel execution of commands connected by |.
  • Subshells: Independent execution environments encapsulated within ( ).
  • Logical Operators: Support for short-circuit evaluation using && and ||.
  • Background Execution: Asynchronous command execution using the & operator.

Redirection

  • Standard I/O: Input (<), Output (>), and Append (>>) redirections.
  • Heredocument: Pre-processing and temporary storage for << operators.

Word Expansion

  • Environment Variables: Expansion of $VAR and special parameter $?.
  • Wildcards (Pattern Matching): Pathname expansion for the * character.
  • Quote Removal: Handling of literal strings within ' ' and " ".

🛠 Technical Constraints

  • Zero Memory Leaks: Maintain a leak-free codebase verified by valgrind or ASan/leaks. Every allocated block must be properly deallocated before the process exits or loops.

  • Strict FD Management: Ensure all pipe and file descriptors are closed immediately after their required lifecycle. Prevent "too many open files" errors by managing FD inheritance during fork.

  • High Robustness: The system must remain stable under all circumstances. Invalid inputs or syntax errors must be caught gracefully, providing informative error messages without crashing the shell.

  • Signal Integrity: Maintain consistent shell behavior during signal interruptions (e.g., SIGINT, SIGQUIT), ensuring the prompt returns correctly and child processes are handled as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions