对“语义"的简单定义.因为它通常与编程语言/API有关? [英] Simple definition of "semantics" as it is commonly used in relation to programming languages/APIs?

查看:114
本文介绍了对“语义"的简单定义.因为它通常与编程语言/API有关?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天我想到,尽管我在提及语言元素和命名约定时已经采用并且很少使用语义"一词,但我对正式定义没有任何感觉.

我在编程领域中找到正式定义的尝试使我大失所望./p>

从我遇到过的上下文以及语言学在语言学中的较普遍用法,我对它的含义有所了解,并且我通常使用该术语来指代 的含义或语言元素的表现力,或名称,意图,行为或功能的保真度 .

不过,这个定义是我自己的想法.我是人类学/英语专业,从未参加过计算机科学课程.这是在CS中教授吗?

是否有一个更准确的定义可以简化为一个或两个语句,而不是详尽无遗的文章?

解决方案

My attempt to find a formal definition in the programming domain made my eyes glaze over.

I have a sense of its meaning from the contexts in which I've encountered it, and from its more common usage with respect to linguistics, and I typically use the term to refer to the meaning or expressiveness of the language element, or the fidelity of nomenclature to the intent, behaviour, or function of that which it names.

This definition, though, is my own idea. I was an Anthropology/English major and have never taken a Computer Science course. Is this taught in CS?

Is there a more accurate definition that can be boiled down to a statement or two, rather than an exhaustive and exhausting article?

解决方案

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.

这篇关于对“语义"的简单定义.因为它通常与编程语言/API有关?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆