Simple definition of “semantics” as it is commonly used in relation to programming languages/APIs?

前端 未结 3 402
轻奢々
轻奢々 2021-02-04 14:18

It occurred to me today that although I\'ve adopted and don\'t infrequently use the term \"semantics\" when referring to language elements and naming conventions, I don\'t have

3条回答
  •  抹茶落季
    2021-02-04 14:50

    A definition cribbed from here is The semantics of a programming language describe the relationship between the syntax and the model of computation.. This is pretty much exactly what your inferred definition was. The sticking point, and what made your eyes glaze over is precisely defining the model of computation.

    There are many different formal models of computation and each leads to a different form of semantics. Operational Semantics is probably closest to the way most people informally model the semantics, having each fragment of code run through an interpreter and changing the state of an abstract routine. This approach breaks down in many models where concurrency or nondeterminism, etc., so there are other sematics better suited to these situations.

提交回复
热议问题