World's most popular travel blog for travel bloggers.

[Solved]: What is a malformed token?

, , No Comments
Problem Detail: 

I am reading Programming Language Pragmatics by Michael Scott. He says that on a first pass, a compiler will break a program into a series of tokens. He says that it will check for malformed tokens, like 123abc or $@foo (in C).

What is a malformed token? A variable that does not meet the rules of variable-naming? An operator that does not exist (ex. "<-")?

Is this analogous to a misspelled word?

Asked By : bernie2436

Answered By : Dave Clarke

The basic syntactic units in any textual programming language are tokens, which are, if you wish, the words in the programming language. The compiler parses these tokens to build sentences and so forth.

A malformed token is a string of characters that is not a valid word for the programming language.

It is not a variable that doesn't match the naming rules – not all tokens are variables. It is not an operator that is unknown – sometimes operators can be defined by the programmer. It is one of the smallest pieces of syntax that will never correspond to something sensible.

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/3278

0 comments:

Post a Comment

Let us know your responses and feedback