C
chessc4c6
Can someone explain to me hoe both C and C++ are context sensitive??
chessc4c6 said:Can someone explain to me hoe both C and C++ are context sensitive??
chessc4c6 said:Can someone explain to me hoe both C and C++ are context sensitive??
chessc4c6 said:Yes it could be, but I'm trying to explain how they are different in
that sense and do not know myself.
chessc4c6 said:Can someone explain to me hoe both C and C++ are context sensitive??
Matthias said:As far as I know, no programming language available has a context
sensitive grammar.
Karl said:Just to clearify.
What is your understanding of 'context sensitive grammer'?
C++ has lots of things in the grammer, which are interpreted differently
depending on the context they appear in. The keyword 'static' comes to my
mind.
Or are you talking about something differently and I am barking up the
wrong tree?
Matthias said:Context sensitive grammar would allow productions like:
a N c ::= a b c
whereas the non-terminal N would be reduced to token b if and only if it
appears in the context of a and c.
At least from what I know, this is not what a compiler does when parsing
a programming language. Productions of common programming languages
never appear in a context, that means, they form context-free grammars.
Victor Bazarov said:In the sense of case sensitivity they are not different. Context
sensitivity WRT C or C++ is something I've never heard of. Sorry.
Llewelly said:Above, the expression '++count' appears 3 times, each time in a
different context. Each time, because of differing context, an
otherwise textually identical expression has different
behavior. (And in other contexts, 'count' could refer to a
template ...)
C++ is filled with context sensitivity. In fact, it has few features
which are not in someway context sensitive.
The real problem with the OP's question is the enourmous number of
ways in which both C and C++ are context sensitive.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.