▗▖ ▗▖▗▄▄▄▖▗▖ ▗▖▗▄▄▄▖ ▗▄▄▖▗▖ ▗▖▗▄▄▄▖▗▖ ▗▖
▐▛▚▞▜▌ █ ▐▛▚▖▐▌ █ ▐▌ ▐▌ ▐▌▐▌ ▐▌ ▐▌
▐▌ ▐▌ █ ▐▌ ▝▜▌ █ ▝▀▚▖▐▛▀▜▌▐▛▀▀▘▐▌ ▐▌
▐▌ ▐▌▗▄█▄▖▐▌ ▐▌▗▄█▄▖▗▄▄▞▘▐▌ ▐▌▐▙▄▄▖▐▙▄▄▖▐▙▄▄▖
Our minishell
with Hanju-kun UwU
PLAN
-
Read from the command line:
- Read the input from the command line.
- The input will be a string of words separated by spaces.
- The program will read the input and store it in a variable.
- Handle the signals
Ctrl+C
andCtrl+D
etc.getcmd()
returns string
-
Syntax check:
- Check if the input is a valid format.
- If the input is not a valid format, print an error message and exit the program.
syntaxcheck()
returns boolean -
Lexical analysis:
- Split the input into typeless tokens.
- Associate the tokens with their respective types.
- Expand the variables if needed.
- Store the tokens in a list with their respective types.
lex()
returns list of tokens
-
Parsing:
-
Execution:
- Execute the command.
- If the command is a builtin command, execute the builtin command.
- If the command is not a builtin command, execute the external command.
execute()
returns None
//WORST CASE //minishell> < infile1 << "lim" > outfile1 echo hello world > outfile2 < infile2 | < infile3 "ca""t" > outfile3 *** BONUS PART*** && echo hello world // ";" not implemented //< infile > outfile NOT NEEDED !!!!!!!!!! //< infile cat > outfile should work //< infile cat | > outfile should NOT WORK //
test="first" another="anything here"
open double quote -> expand variable -> split by space expand variable -> split by space open single quote -> split by space