To remove all comments in a JavaScript file, do we need just a scanner or also a parser?
Scanner (tokenizer) will be enough. Most programming languages do not allow comment nesting, so there is no need to use recursive parsers to strip all comments.