![]() |
The terminal is a file, therefor it treats all inputs as strings |
![]() |
|---|
Important
After calling the readline() to capture user's input in the main(), our code goes basically like this:
- Define Tokens and Check for initial errors, like: unmatched quotes or parentheses
- With Automata State in Lexer (token labeling), create the token list.
- Parse (or verify sintax, similar language grammar)
- Apply Redirect rules in Parse, if detected
- Check HereDoc
- Build the Binary Tree, in recursive mode
- Preparing Execution in Binary Tree
- Execute
8.1 Expansion of special tokens
8.2 Built-ins
8.3 Command Manager
- Makefile working and calling minUnit tester 🎉 [https://github.com/biralavor/42_minishell/releases/tag/v0.0.1]
- Test development with multiple files call, avoiding the horrible monolith file 🎉 [#31]
- Lexer 🎉 [https://github.com/biralavor/42_minishell/releases/tag/v0.2]
- Parser + Syntaxe Grammar 🎉 [https://github.com/biralavor/42_minishell/releases/tag/v0.3]
- SubShell + Binary Tree + Environment Variables 🎉 [https://github.com/biralavor/42_minishell/releases/tag/v0.4]
- Execution 🎉 [https://github.com/biralavor/42_minishell/releases/tag/v0.6]
- Built-ins 🎉 [https://github.com/biralavor/42_minishell/releases/tag/v0.6]
- Variables Expansion 🎉 [https://github.com/biralavor/42_minishell/releases/tag/v0.7]
- Redirects of all types, except HereDoc 🎉 [https://github.com/biralavor/42_minishell/releases/tag/v0.9.5]
- HereDoc Redirect 🎉 [https://github.com/biralavor/42_minishell/releases/tag/v0.9.0]
- Signals Control -> Ctrl+C and Ctrl+D 🎉 [https://github.com/biralavor/42_minishell/releases/tag/v0.9.6]
- Memory Leaks Management at: Lexer, Parser 🎉 [https://github.com/biralavor/42_minishell/releases/tag/v0.9.8]
- Memory Leaks Management at: Expansion, Builtins 🎉 [https://github.com/biralavor/42_minishell/releases/tag/v0.9.8]
- Memory Leaks Management at: Manage Single Command 🎉 [https://github.com/biralavor/42_minishell/releases/tag/v0.9.8]
- Memory Leaks Management at: HereDoc, when Ctrl+C is activated 🎉 [https://github.com/biralavor/42_minishell/releases/tag/v0.9.9.8]
- Signals Control -> Ctrl + \ 🎉 [https://github.com/biralavor/42_minishell/releases/tag/v0.9.9.8]
- Next Steps on Project Management:
- Norminette
- Possible Bonus Development:
- If
&&were inside(), it should execute with priority (SUBSHELL) - If
||were inside(), it should execute with priority (SUBSHELL) - Expansion for wildcards (*)
- If
What we are testing, until so far:
- initial_errors, like unmachted quotes and parentheses
- mixed quotes
- crazy parentheses counter
- creating the token linked list
- syntax validations for
words,pipes,and,or,pipesmixed withandandor - syntax validations for
redirect_input,redirect_output,redirect_output_append,redirect_heredoc,mixed redirects,subshell - syntax rules for
archive,word_after_archive,redirect_with_another_redirect - syntax rules for
reorganize_redirects
- Define Tokens for possible user's input:
- The hability to label specific strings as tokens, like below:
Check this test: echo oi > tudo > bem com voce > ?
- The goal here is to create syntax grammar validations to avoid have a future binary tree with execution erros
- We created Automata States, just to have a better workflow
- The goal here is to:
- Detects if there is more then one redirect type
- If so, it move tokens to a new order, for an easier futher execution
Remember this test from Lexer?
echo oi > tudo > bem com voce > ?
Now, we got un updated result:
The Binary Tree will be executed, following the metacharacters rules:
- Expansion for:
- Quotes
" - tilde
~ - dollar sign
$
- Quotes
- Built-in Detectors
- Built-in Manager
- Built-in Runners
Built-ins, if detected, or classic commands. Therefor, also have a bool builtin_detector() and void builtin_manager for both types of built-ins.
If the input isn't a Built-in, it runs execve. We have two built-in categories for our minishell version:
- Builtins without argument, like:
env,pwd,exit. - Builtins with argument, like:
echo,cd,export,unset.
- Thais Malheiros -> https://github.com/Thais-Malheiros/
- Bira Lavor -> https://github.com/biralavor/
All 42 Badges -- the astronomer Human Coder -- were done by Larissa Cristina @mewmewdevart















