Vyxal 3Ṡ
, 80 79 bytes
Dð4ק,0$"<>+-.,[]"£([¥nc[⁰Lm-ꜝðק¹,|n§1#x)4m+ðק¥nḞꜝ:[#?Ḣin§⁰Lm-ðק,0|n§1][ð§¹,
Explanation:
Setup:
Dð4ק,0$"<>+-.,[]"£(ð4ק ## Print " " without newlineD , ## Print the first line of input with newline"<>+-.,[]"£ ## Put "<>+-.,[]" in the register 0$ ## Push the 0 in the stack (Swapped because the top of the stack is used for looping) ( ## Loop every char in the first line of input
Looping part:
[¥nc[⁰Lm-ꜝðק¹,|n§1#x)4m+ðק¥nḞꜝ:[#?Ḣin§⁰Lm-ðק,0|n§1][¥nc[ ## if the current character is in "<>+-.,[]"⁰Lm-ꜝðק¹, ## print that many spaces, then the second line of input, with newline. |n§1#x) ## else print the current character and continue with the 1 in the top of the stack. 4m+ðק ## Print that many spaces¥nḞꜝ ## index of the current character (1 to 8, 0 if not found) :[ ## if the index of the current character is 1 or more #?Ḣin§⁰Lm-ðק,0 ## Print that many spaces, then the right explanation, with newline, and push 0 |n§1] ## else, print the current character, and push 1
Final part:
[ð§¹,[ ## If the top of stack is 1 or greater ## (I have no idea why that works)ð§ ## print " " without newline¹, ## Print the second line of input, with newline💎
Created with the help of Luminespire.