![](https://private-user-images.githubusercontent.com/80487147/367397456-aad813db-13ee-4665-bed0-d444a0c1dcdf.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5ODgxNjAsIm5iZiI6MTczODk4Nzg2MCwicGF0aCI6Ii84MDQ4NzE0Ny8zNjczOTc0NTYtYWFkODEzZGItMTNlZS00NjY1LWJlZDAtZDQ0NGEwYzFkY2RmLmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDA0MTEwMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRjMWZkMjJmMjg0ODg4ZWI1NGQ1M2IyMTY0ZjQ3NGNiMzIwYTExZWZhMmVhZjVmMTFkZmI4ODI5MTk5NmU3MzcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.QF77xbkgfUdSa5nch__gUu5hEfM0iuckSPda4oOXAP0)
![](https://private-user-images.githubusercontent.com/80487147/377573799-097957fc-e4e2-42bd-b6f4-89461aa860e5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5ODgxNjAsIm5iZiI6MTczODk4Nzg2MCwicGF0aCI6Ii84MDQ4NzE0Ny8zNzc1NzM3OTktMDk3OTU3ZmMtZTRlMi00MmJkLWI2ZjQtODk0NjFhYTg2MGU1LnBuZz9YLUFtei1BbGd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mVkSGVhZGVycz1ob3N0In0.2Q-MhB4S6yl-gDVGkQ0BTgdIS8IlU6ZgT6b58ufFhEk)
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
,pipes
mixed withand
andor
- 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/