473,657 Members | 2,432 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C tokens

Lexical generators such as Bison, Flex, Lex, &c produce C tokens for the
parser or compiler. What do these C tokens look like? According to ANSI C,
what does the standard have to say about C tokens? Does anyone know?

Bill
Nov 14 '05 #1
6 3604
Bill Cunningham wrote:

Lexical generators such as Bison, Flex, Lex, &c produce C tokens for the
parser or compiler. What do these C tokens look like? According to ANSI C,
what does the standard have to say about C tokens? Does anyone know?


The Standard defines "preprocess ing token" and "token,"
but nothing called a "C token."

A "preprocess ing token" is a header name, an identifier,
a "pp-number," a character constant, a string literal, or a
punctuator.

A "token" is a keyword, an identifier, a constant, a string
literal, or a punctuator.

You'll notice a certain amount of overlap. This arises from
the way the Standard describes the translation of C source code
into executable programs: in the early stages of translation
(roughly speaking, up through the point where the preprocessor
has finished its work), the translation is described in terms of
converting incoming characters into preprocessing tokens and
performing various manipulations on them. Later stages convert
the preprocessing tokens into tokens, and attach various meanings
to them. For example, the two terms make it easy to explain why
`sizeof' cannot be evaluated by the preprocessor.

What do these preprocessing tokens and tokens "look like?"
Whatever the implementor finds convenient and pleasing. The
compiler will typically build data structures describing the
preprocessing tokens and tokens constructed from the source, and
will record various bits of useful information to assist the
further actions of the translation. An "identifier ," for example,
will probably carry an indication of its scope, of its linkage
(internal, external, or none), and a description of the thing
it names. It might also carry additional handy information like
"The `&' operator is never applied to this identifier, so it's
eligible to be put into a register" -- but all such decorations
are at the implementor's whim.

Personally, I favor a sort of deep teal -- long on the blue,
and not too much green.

--
Er*********@sun .com
Nov 14 '05 #2
"Bill Cunningham" <no****@nspam.n et> wrote in message
news:10******** *****@corp.supe rnews.com...
Lexical generators such as Bison, Flex, Lex, &c produce C tokens for the parser or compiler. What do these C tokens look like? According to ANSI C,
what does the standard have to say about C tokens? Does anyone know?


Bill, I see your name popping up in lots of different newsgroups with *very*
confused posts.
You are learning C, win32 API, ActiveX/OLE and DirectX all at once? You
would be better off if you spend some time coding only standard C and only
when you are comfortable with it you should learn a new API. And please, one
at a time.
Nov 14 '05 #3
Bill, I see your name popping up in lots of different newsgroups with *very* confused posts.
You are learning C, win32 API, ActiveX/OLE and DirectX all at once? You
would be better off if you spend some time coding only standard C and only
when you are comfortable with it you should learn a new API. And please, one at a time.

I've given up. Atleast for now on directx. I am interested in win32 API
and COM as well as C++. <sigh> yes Ibelieve I have a little too much on my
plate. I've found a couple of good C tutorials though and I'm going to focus
on them. Then after learning C thoughly as I should've long ago, I may move
on to C++ and win32/COM programming.

Bill

Nov 14 '05 #4
kal
"Bill Cunningham" <no****@nspam.n et> wrote in message news:<10******* ******@corp.sup ernews.com>...

I've given up. Atleast for now on directx. I am interested in win32 API
and COM as well as C++. <sigh> yes Ibelieve I have a little too much on my
plate. I've found a couple of good C tutorials though and I'm going to focus
on them. Then after learning C thoughly as I should've long ago, I may move
on to C++ and win32/COM programming.


FYI: "COM" is now obsolete. It has been replaced by .NET.
Nov 14 '05 #5
In <a5************ **************@ posting.google. com> k_*****@yahoo.c om (kal) writes:
FYI: "COM" is now obsolete. It has been replaced by .NET.


Who cares?

If you feel compelled to make such a comment, use private email for this
purpose!

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #6
Dan Pop wrote:
In <a5************ **************@ posting.google. com> k_*****@yahoo.c om (kal) writes:

FYI: "COM" is now obsolete. It has been replaced by .NET.

Who cares?

If you feel compelled to make such a comment, use private email for this
purpose!


Especially when it's not even a true statement. I'll leave it at that
since COM and .NET totally off-topic for this newsgroup.
Nov 14 '05 #7

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

Similar topics

0
1126
by: Jonathan Fine | last post by:
I'm sort of wishing to convert TeX tokens into characters. We can assume the standard (i.e. plain) category codes. And that the characters are to be written to a file. This proceess to take place outside of TeX. Say in a Python program. Think of a pretty-printer. * Read the TeX in as tokens.
2
3506
by: Aurelien Mazurie | last post by:
Hello to all, I'm trying to do a weird (?) thing with regexp and MySQL. For example, i have a column with: token1|token2|token3 (three tokens separated by pipes) I'm trying to write an SQL query in order to look for the presence of one of these tokens, that is "look for a string like 'tokenX' that is preceded by the beginning of the line OR a pipe, AND that is followed
10
2625
by: Christopher Benson-Manica | last post by:
(if this is a FAQ, I apologize for not finding it) I have a C-style string that I'd like to cleanly separate into tokens (based on the '.' character) and then convert those tokens to unsigned integers. What is the best standard(!) C++ way to accomplish this? -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
7
2652
by: Steven Woody | last post by:
in C, is there any function can be used to decompose tokens from a string? if not, can i find it in CPP? thanks! -- steven woody (id: narke) Celine: Well, who says relationships have to last forever? - Before Sunrise (1995)
4
3034
by: Jay Nesbitt | last post by:
Is there a quick way to extract tokens from a string of text? I know Java provides a StringTokenizer class to do this. Is there something similar in the dot net framework? Ex. string s = "some text then #token1# and then #token2#"; string tokens = tokenizer.GetTokens(s, "#"); The contents of the tokens array would then be token1 and token2. Thanks!
0
1297
by: kamal9 | last post by:
#include <stdio.h> #include <string.h> void string2Lines(char line, char tokens){ char *token_ptr, token; char *i=";" " " "," "." "?" "!"; token_ptr = strtok(line, i ); while(token_ptr){ strcpy(token, token_ptr); strcat(tokens, strcat(token,"\n"));
1
2962
by: kara18 | last post by:
Hi, After splitting a string in to tokens using strtok ,how can I get the tokens in to different arrays. for example char str = "now # is the time for all # good men to come to the # aid of their country"; char delims = "#"; char *result = NULL; result = strtok( str, delims ); while( result != NULL ) { printf( "result is \"%s\"\n", result ); result = strtok( NULL, delims );
5
3353
by: gpaps87 | last post by:
hi, i wanted to know whether we can use strtok command to mark delimiters as tokens as well.In Java,we have a command: StringTokennizer(String str, String delimiters, boolean delimAsToken) which considers the delimiters as tokens,too.Can strtok accomplish this requirement?or could you please let me know if there is any other command in C that would carry out this task?
14
2933
by: mdh | last post by:
Hi all, From p 125, gives rise to this issue for me. Is it true that a "token" in C ( philisophically ) is the least amount of digits/chars/underscores/*s ( and other non blank space that I have not thought of) that the compiler uses to derive useable information. So, this would be a token " ( ) "
0
8413
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
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8513
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
8617
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
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2742
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.