Re: Why put type information into syntax?

"Rodney M. Bates" <rod.bates@wichita.boeing.com>
5 Apr 2000 22:23:07 -0400

          From comp.compilers

Related articles
[2 earlier articles]
Re: Why put type information into syntax? lex@cc.gatech.edu (2000-03-28)
Re: Why put type information into syntax? RobertADuffbobduff@world.std.com> (2000-03-28)
Re: Re: Why put type information into syntax? srineet@email.com (Srineet) (2000-04-01)
Re: Why put type information into syntax? tlh20@cam.ac.uk (Tim Harris) (2000-04-01)
Re: Why put type information into syntax? kst@cts.com (Keith Thompson) (2000-04-01)
Re: Why put type information into syntax? michael.prqa@indigo.ie (Michael Spencer) (2000-04-05)
Re: Why put type information into syntax? rod.bates@wichita.boeing.com (Rodney M. Bates) (2000-04-05)
Re: Why put type information into syntax? kst@cts.com (Keith Thompson) (2000-04-11)
Re: Why put type information into syntax? idbaxter@semdesigns.com (Ira D. Baxter) (2000-04-14)
Re: Why put type information into syntax? world!bobduff@uunet.uu.net (Robert A Duff) (2000-04-14)
Re: Why put type information into syntax? maratb@CS.Berkeley.EDU (Marat Boshernitsan) (2000-04-15)
Re: Why put type information into syntax? mspencer@eircom.net (Michael Spencer) (2000-04-15)
| List of all articles for this month |

From: "Rodney M. Bates" <rod.bates@wichita.boeing.com>
Newsgroups: comp.compilers
Date: 5 Apr 2000 22:23:07 -0400
Organization: The Boeing Company
References: 00-03-133 00-03-148 00-04-007
Keywords: types, parse

I think this thread has largely misunderstood the original question.


The question was not "why are builtin types needed?" It was why
should the syntax treat the _names_ of builtin types as reserved words
instead of ordinary identifiers. In many languages,
programmer-defined and builtin type names appear in exactly the same
contexts. So making the builtin type names be predefined identifiers,
instead of reserved words, yields the same language and makes the
syntax more robust.


Of course C syntax can't be fixed to work this way. The fact that the
mere presence/absence of a declaration (most pertinently, because an
include file is not found) can change whether subsequent C code is
syntactially correct or not speaks for itself about this design.


Srineet wrote:
> I think there is another reason for built in types. Some language
> features rely on them, for example, in C the expression in an
> if-statement / while-statement etc. must be coercable to int. Now, if
> there was no built-in int type, what rule can you have for that? This
> is even more relevant for languages with a builtin boolean type, where
> the if-condition-expression must be boolean. So we see that some
> builtin types not only make the gammar "easy to specify" but are in
> fact necessary.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.