|newbie: general compilers question: static checking firstname.lastname@example.org (Neil Zanella) (2003-11-02)|
|Re: newbie: general compilers question: static checking derkgwen@HotPOP.com (Derk Gwen) (2003-11-08)|
|Re: newbie: general compilers question: static checking email@example.com (Brian Clausing) (2003-11-08)|
|Re: newbie: general compilers question: static checking bobduff@shell01.TheWorld.com (Robert A Duff) (2003-11-08)|
|Re: newbie: general compilers question: static checking firstname.lastname@example.org (2003-11-08)|
|From:||Brian Clausing <email@example.com>|
|Date:||8 Nov 2003 01:35:58 -0500|
|Organization:||Posted via Supernews, http://www.supernews.com|
|Posted-Date:||08 Nov 2003 01:35:58 EST|
Neil Zanella wrote:
> I have seen the words "static checking" in the context of compilers
> several times as something typically done in between the parsing and
> intermediate code generation phases of the compiler. Could anyone
> please explain to me what static checking is? Also, is it a front-end
> issue or a back-end issue? Seems like a front-end issue to me since it
> seems to be language dependent. Seems to me like static checking is
> part of semantic analysis.
> I think static checking has to do with checking type compatibility of
> assignment, arithmetic, and other operators. Perhaps someone can confirm
> this with me. I am not sure why this is so but some texbooks also call
> the following static checking:
> - checking that break statements do not appear outside enclosing
> constructs where a break statement may appear
> - checking that elements of enmerated types are not repeated
> - checking that variable names do not appear in the same lexical scope
> - checking that labels are not repeated
> So, static checking seems to encompass a variety of semantic checks.
> In general, how do I tell whether a check done by the compiler falls
> under the category of static checking, and what is the relevance of
> the word static in the words static checking?
> Perhaps someone can elaborate on static checking.
> In particular, I would like to know what the relationship between
> semantic analysis and static checking is. It would appear to me
> that the two terms could almost be used interchangeably. Is
> this correct?
I think that, like many terms of the trade, there's no general
agreement on the precise definition of static checking, but there
should be considerable concurrence on what's generally meant. I've
always supposed that "static type checking" refers to just what you've
said about checking type compatibility. Some more definite
1. Static checking consists of checking the grammatical rules of a
language that cannot easily be expressed by the context-free grammar.
This seems to cover all the instances you mention.
2. Or it consists of checks that can be done using the abstract syntax
tree and information in the symbol table without additional elaborate
processing. This is operational ("what my parser does...") and relative
("...with language X") and might be useful in discussing particular
compiling techniques with a given language.
The relationship between static checking and semantics analysis depends
on the context (pun intended). The useful division in discussion of
practice may be that semantics analysis is whatever lexical analysis
doesn't do and code generation can't, but that's more of an evasion than
a definition, and I'll read other replies with interest.
Return to the
Search the comp.compilers archives again.