The main difference between syntax analysis and semantic analysis is that syntax analysis takes the tokens generated by the lexical analysis and generates a parse tree while semantic analysis checks whether the parse tree generated by syntax analysis follows the rules of the language.
https://pediaa.com/what-is-the-difference-between-syntax-analysis-and-semantic-analysis/