For scanner or tokenizing the input stream i used mostly sre trigger.
https://matt.might.net/articles/lexers-in-racket/
https://docs.racket-lang.org/parser-tools/Lexers.html#%28part._.Lexer_.S.R.E_.Operators%29
For Parser funcations the most useful resources I found are the following
https://docs.racket-lang.org/denxi-reference/Monads.html
https://docs.racket-lang.org/functional/interfaces.html
https://docs.racket-lang.org/functional/either.html
I did not use chatgpt or any other large language model.
When error inside while loop it gives the syntax error line number where the loop starts.