[Cocci] 答复: 答复: what is the function of 'position' in SMPL

Julia Lawall julia.lawall at lip6.fr
Tue Feb 18 10:00:56 CET 2014


On Tue, 18 Feb 2014, 林嘉(程二 福州) wrote:

> Thanks,  So, what's the difference between 'statement' and 'expression'?
> I guess statement means a complete line in c code, such as  's = socket(...);' while expression means an incomplete part, e.g. right hand of operator, 'socket(inet, 0, 0, 0)' ?

A statement has no value.  So like s = socket(...); but also if (...)
return;, etc.

An expression has a value.  So like 3 + 4, f(), etc.  x = y without a
trailing semicolon is also an expression.

There is a simple grammar for a C-like language here:

http://marvin.cs.uidaho.edu/Teaching/CS445/c-Grammar.pdf

This is not the grammar that we follow, but it can give the idea.

julia


More information about the Cocci mailing list