Is it possible to make a whitespace formatter using a given SQL grammar?

Hi, we wanted to make a whitespace formatter for a language that has a given SQL grammar, could you give us a direction if possible? Thank you!

That’s not something this project can be of any help with.

Will a recursive print of the parse tree with appropriate whitespaces inserted between specific tokens not being a possible approach to help with implementing a whitespace formatter?