473,804 Members | 4,223 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2435
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.goo glegroups.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.c om, 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.********@com Acast.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

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

Similar topics

1
3449
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 collections I am thinking that since you are processing the source page on the server, then transfer to the destination page, all of this is happening on the server, and so there is no way of tampering with it. Am I correct or way off? If this is...
0
2269
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) in the user's registry. The latest e-mail we received from development states: "Launching help with a certain topic using a Map ID is not supported in the C#.NET API. Well there is always a work around but would violate the .NET help...
0
568
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 link doesn't work, basically here is the article: An Exploration Into Launching Context-Sensitive HTML Help with Topic IDs in VB.NET I spent this evening investigating the HTML Help API as implemented in
0
1346
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 started adding Context-sensitive help to my Access 2000 application. On the first form I am working on, it seems that the text boxes respond to the Context-sensitive 'What's this ?' but the labels and image controls do not, even though they have...
5
2619
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 I've setup the registry keys to have a profile and I specify an AppHelpFile and TitleBar in that profile. This works swell: when I startup my application in runtime with the /profile option and then I press F1 on a form, our help file appears....
0
1621
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. Here is how you can reproduce it: 1. Create a form, in its properties, set the MinimizeBox and MaximizeBox to
0
907
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 not get context sensitive help for myCollection probably because my dim is not defining 'As something'. Is there an object available/importable that will give me the context sensitivity
0
1881
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 to use to make context sensitive help work within a .Net-created application? Many thanks in advance. Sincerely, -Shawn
2
3177
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
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10577
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10320
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10077
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9150
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7620
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.