473,379 Members | 1,191 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

How C and C++ are context sensitive

Can someone explain to me hoe both C and C++ are context sensitive??

Jul 23 '05 #1
10 2373
chessc4c6 wrote:
Can someone explain to me hoe both C and C++ are context sensitive??


Could it be you're confusing that with "case-sensitive"?
Jul 23 '05 #2
Yes it could be, but I'm trying to explain how they are different in
that sense and do not know myself.

Jul 23 '05 #3

"chessc4c6" <pr***********@aol.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Can someone explain to me hoe both C and C++ are context sensitive??


Are you referring to the grammar(s)? I suspect there are several parts of
the grammar(s) that make it context sensitive, but I'd say off-hand that the
fact that one needs to know if a given token is a typename or not, while
parsing, is the main reason. Both languages have the typdef keyword which
introduces context sensitivity by defining a new typname. And C++ has a lot
of other constructs that I'd guess make it so, such as templates.

Search on groups.google.com, and you're sure to get a lot of hits.

-Howard
Jul 23 '05 #4
chessc4c6 wrote:
Yes it could be, but I'm trying to explain how they are different in
that sense and do not know myself.


In the sense of case sensitivity they are not different. Context
sensitivity WRT C or C++ is something I've never heard of. Sorry.

V
Jul 23 '05 #5
chessc4c6 wrote:
Can someone explain to me hoe both C and C++ are context sensitive??


As far as I know, no programming language available has a context
sensitive grammar. Context sensitivity is extremely hard to handle, and
more appropriate to spoken languages anyway.

--
Matthias Kaeppler
Jul 23 '05 #6
Matthias Kaeppler wrote:

chessc4c6 wrote:
Can someone explain to me hoe both C and C++ are context sensitive??


As far as I know, no programming language available has a context
sensitive grammar.


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?

--
Karl Heinz Buchegger
kb******@gascad.at
Jul 23 '05 #7
Karl Heinz Buchegger wrote:
Matthias Kaeppler wrote:
chessc4c6 wrote:
Can someone explain to me hoe both C and C++ are context sensitive??


As far as I know, no programming language available has a context
sensitive grammar.

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?


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.

--
Matthias Kaeppler
Jul 23 '05 #8
Matthias Kaeppler wrote:

Karl Heinz Buchegger wrote:
Matthias Kaeppler wrote:
chessc4c6 wrote:

Can someone explain to me hoe both C and C++ are context sensitive??
As far as I know, no programming language available has a context
sensitive grammar.

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?


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.


Thanks for the clearification.
A long time has gone since my compiler construction lessons :-)

--
Karl Heinz Buchegger
kb******@gascad.at
Jul 23 '05 #9
Victor Bazarov <v.********@comAcast.net> writes:
chessc4c6 wrote:
Yes it could be, but I'm trying to explain how they are different in
that sense and do not know myself.


In the sense of case sensitivity they are not different. Context
sensitivity WRT C or C++ is something I've never heard of. Sorry.


huh?

int count= 0;

void foo()
{
++count; //in this context, the global count is incremented.
}

void bar()
{
static int count= 0;
++count; //in this context, the static count local to the function
//bar is incremented.
}

namespace baz
{
int count= 0;
void qux()
{
++count; //in this context, the count inside of namespace baz is incremented.
}
}

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.

Jul 23 '05 #10
gb
Llewelly wrote:
Victor Bazarov <v.********@comAcast.net> writes:

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.


Context-sensitivity is a linguistic term that has to do with the rules
of
the grammar (i.e., what is syntactically correct), not the semantics of
the
program (i.e., what the program does). Your examples don't demonstrate
context-sensitivity in the grammatical sense.

Gregg

Jul 23 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: | last post by:
When passing values from one page to another using context.items collection & server.transfer, how secure is this data? This is using the notion that you add an item to the context.items...
0
by: Denise L. Moss-Fritch | last post by:
Has anyone developed context sensitive help for a C# application? According to our programming staff, the development side is not able to provide links without adding hard coded links (topic names)...
0
by: tbatwork828 | last post by:
If you were like me trying to figure out how to launch context sensitive help topic by the context id, here is the link: http://weblogs.asp.net/kencox/archive/2004/09/12/228349.aspx and if...
0
by: ctyrrell | last post by:
Does anyone know of any restrictions of controls on Access forms that makes them ineligible for Context-Sensitive help? Are some types of controls not able to be made context-sensitive? I have...
5
by: TD | last post by:
Hey All, I am hooking up our custom html (.chm) help file to our Access xp application, and, despite reading several posts and manuals on this, I still have a gap in my understanding... OK, so...
0
by: Renee | last post by:
Hi there, does any one know how to create context sensitive help for Groupbox control with HelpProvider class? I can create context sensitive help for any control easily except for Groupbox. ...
0
by: raaco | last post by:
Hi all, It seems there is some context sensitive help when writing html, however if I do something like this Dim myDoc = AxWebBrowser1.Document Dim myCollection = myDoc.all.tags("td") I do...
0
by: Shawn K. N. | last post by:
Hi. We were able to have context sensitive help using RoboHelp for ASP applications, but now that we are using .Net our scripting is no longer working. Can someone help us find the initial scripting...
2
by: Keith Hutchison | last post by:
G'day Is it possible to do custom context sensitive menus within MS Access. If yes, does anyone have a sample example? Thanks in advance Keith
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.