I'd read around on the interwebs, and a lot of the text indicated that many programming languages are generated by a context-free grammar, which leads me to 2 questions:
Doesn't variable scoping require a context-sensitive grammer? Particularly, I'm thinking of the following valid C code:
int main(){
int count=0;
count++;
return count;
}
As opposed to the following invalid C code:
int main(){
count++;
int count=0;
return count;
}
There could also be some other stuff involving namespaces and classes for C++, or the '.' operator for C structs, for example. I get the impression that, as a result, C (and various descendents) does (do) have context-sensitive aspects (though this may only be partial context-sensitivity). Thus question 1:
Is it correct to say that C and some derivative languages, as well as some other languages, can only be generated by grammars with a minimum of context-sensitivity?
Secondly is there a relationship between language class and grammar class?
Particularly, I'm thinking of the language BrainF*** when I ask, since its syntax is clearly generated by a context-free grammar, yet its implementation is turing complete (assuming an implementation with an infinite tape). Does this mean that there are languages that have regular grammars, yet are turing complete?