C tokens

B

Bill Cunningham

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
 
E

Eric Sosman

Bill said:
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 "preprocessing token" and "token,"
but nothing called a "C token."

A "preprocessing 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.
 
S

Servé La

Bill Cunningham said:
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.
 
B

Bill Cunningham

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
 
K

kal

Bill Cunningham said:
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.
 
D

Dan Pop

In said:
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
 
F

Fao, Sean

Dan said:
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.
 

Ask a Question

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.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,228
Latest member
MikeMichal

Latest Threads

Top