Are semantics and syntax the same?

前端 未结 9 814
旧时难觅i
旧时难觅i 2021-01-30 01:55

What is the difference in meaning between \'semantics\' and \'syntax\'? What are they?

Also, what\'s the difference between things like \"semantic website vs. normal we

9条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-30 02:43

    A program that is syntactically correct will compile and run.

    A program that is semantically correct will actually do what you as the programmer intended it to do. i.e. it doesn't have any bugs in it.

    Two programs written to perform the same task in different languages will use different syntaxes, but they would be the same semantically.

提交回复
热议问题