Version: 0.2.0
AwesomeShell is a lightweight, yet powerful Unix-like shell designed for advanced scripting and command execution. It combines a robust lexer with a sophisticated AST engine, enabling precise parsing and execution of complex shell commands.
- Command Execution: Run system commands with full support for chaining (&&, ||) and sequences (;).
- Variables & Assignment: Define and use shell variables dynamically. Supports $? to access last command exit status.
- Advanced Lexer & AST: Parses input into a detailed abstract syntax tree, covering most shell node types for accurate evaluation.
AwesomeShell processes input in three stages:
-
Lexing The lexer tokenizes input into structured tokens
-
AST Construction After lexing, the parser builds an advanced abstract syntax tree (AST) representing the hierarchical structure of commands:
SequenceNode
├── CommandNode: VAR=hello
├── BackgroundNode
│ └── SubshellNode
│ └── LogicalNode (OR)
│ ├── LogicalNode (AND)
│ │ ├── PipelineNode
│ │ │ ├── CommandNode: echo $VAR
│ │ │ │ └── VariableNode: $VAR
│ │ │ └── CommandNode: grep h
│ │ │ └── LiteralNode: h
│ │ └── CommandNode: cat < out.txt
│ │ └── RedirectionNode: < out.txt
│ └── CommandNode: echo "fail"
│ └── LiteralNode: "fail"
├── CommandNode: echo $(date) >> log.txt
│ ├── CommandSubstNode: $(date)
│ │ └── CommandNode: date
│ └── RedirectionNode: >> log.txt
- Lowering & Execution The AST is then lowered into intermediate code by the lowerer. This intermediate representation is finally passed to the executor, which performs the actual command execution while respecting variables, logical operators.
VAR=hello
echo $VAR && echo "World" || echo "Failed"
AwesomeShell is licensed under the GPL-3.0. See LICENSE for details.