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
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to