'How does bash redirection work under the hood?

I'm trying to reimplement the bash redirection and execution part for a small project, but I don't figure out how it works.

For example :

cat <<limit <<limit <<limit

I don't know why all of them executed even an error parse show up

bash-3.2$ <<lim | <<lim2 <><><
bash: syntax error near unexpected token `<>'
> lim
> lim2
bash-3.2$ 

in other case they didn't execute

bash-3.2$ <<lim | <<lim2 <><>< <<lim3
bash: syntax error near unexpected token `<>'
> lim
> lim2
bash-3.2$ 


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source