How kobeevb05-del/shell_project works
This is an educational shell command-line analyzer, not a command executor. The main workflow reads command text, tokenizes it, optionally parses the tokens into an AST, and prints tokens or the AST; lexical and syntax errors are reported to stderr. The parser excerpt shows the grammar stages and AST operations, while the README documents supported syntax and explicitly excludes execution. The graph omits unsupported runtime behavior.
Main entry points: main.c CLI entry · parser.c Parser entry · lexer.c Lexer · token.h Token stream
Components 13
CLI interface
- CLI entry
src/main.c - Input reader
src/main.c
Command analysis
- Lexer
src/lexer.c - Parser entry
src/parser.c - Command lists
src/parser.c - And-or stage
src/parser.c - Pipeline stage
src/parser.c - Command stage
src/parser.c
Token and AST
- Token stream
src/token.h - Command AST
src/ast.h - AST printer
src/ast.c
Other components
- Shell user
- Terminal
Connections 18
- Shell user → CLI entry: provides command
- CLI entry → Input reader: reads input
- Input reader → CLI entry: returns text
- CLI entry → Lexer: tokenizes input
- Lexer → Token stream: produces tokens
- CLI entry → Token stream: prints tokens
- CLI entry → Parser entry: parses tokens
- Parser entry → Token stream: reads tokens
- Parser entry → Command lists: parses list
- Command lists → And-or stage: parses items
- And-or stage → Pipeline stage: parses operands
- Pipeline stage → Command stage: parses commands
- Parser entry → Command AST: builds tree
- CLI entry → AST printer: prints AST
- AST printer → Command AST: reads tree
- CLI entry → Terminal: writes output
- Lexer → CLI entry: returns errors
- Parser entry → CLI entry: returns errors