And I want to show you an example of this, to lead to both the syntax, and to the semantics.
我要给大家讲一个例子,让大家学习语法,和语义。
Second thing we want to talk about very briefly as we go along is the semantics of the language.
我们要说的第二点,是语言的语义。
So actually, the problem with static semantics is you'd like it to catch everything, you don't always get it.
因此实际上,你希望静态语义检查,能捕获所有的错误,但是经常结果不是这样的。
The semantics was what caused the problem, because the operator was expecting a particular kind of structure there.
引起问题的是语义,因为运算符需要的是,一种特定种类的数据结构。
OK. What happens if you actually have something that's both syntactically correct, and appears to have correct static semantics, and you run it?
好,当你的代码语法,没错误,并且也有正确的静态语义,你去运行它的时候会发生什么呢?
And I want to describe both the syntax, what we're doing, and then the semantics of how do we use it and what does that mean.
现在我想解释一下语法,我们在做什么,还有我们使用时的符号,以及意义。
Just like with a natural language, we're going to separate out syntax versus semantics.
就像自然语言一样,我们要去把语法和语义区分开来。
Not everything is going to get caught in static semantics checking.
并不是所有的错误,都会在静态语义检查中被捕获。
The last piece of it is, in addition to having static semantics, we have sort of full semantics.
最后一部分是,除了static语义之外,我们还有一些full语义。
What's the point? Again, you can have things that are syntactically legal but not semantically meaningful, and static semantics is going to be a way of helping us decide what expressions, what pieces of code, actually have real meaning to it. All right?
重点是什么?重申,你可以有东西在语义结构的逻辑上有意义,但是在语义上无意义,而static语义,将是一个帮助我们,决定哪些表达,哪部分的代码实际上,有意义的途径,好么?
应用推荐