using stack library for bracket matching