language design implications for variant records in a pascal-like language

noitalmost <noitalmost@cox.net>
Wed, 22 Dec 2010 15:03:54 -0500

          From comp.compilers

Related articles
language design implications for variant records in a pascal-like lang noitalmost@cox.net (noitalmost) (2010-12-22)
Re: language design implications for variant records in a pascal-like gneuner2@comcast.net (George Neuner) (2010-12-23)
Re: language design implications for variant records in a pascal-like danielzazula@gmail.com (Daniel Zazula) (2010-12-24)
Re: language design implications for variant records in a pascal-like bobduff@shell01.TheWorld.com (Robert A Duff) (2010-12-24)
Re: language design implications for variant records in a pascal-like mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2010-12-25)
Re: language design implications for variant records in a pascal-like DrDiettrich1@aol.com (Hans-Peter Diettrich) (2010-12-25)
Re: language design implications for variant records in a pascal-like gene.ressler@gmail.com (Gene) (2010-12-27)
[59 later articles]
| List of all articles for this month |

From: noitalmost <noitalmost@cox.net>
Newsgroups: comp.compilers
Date: Wed, 22 Dec 2010 15:03:54 -0500
Organization: Compilers Central
Keywords: design, question

A while back, I created a toy language and compiler with a syntax similar to
Pascal or Oberon (like what you'd do in an undergrad compiler course). Now I'm
working on expanding it to a "real" language. I plan eventually to add a class
type (in the sense of Java or C++ classes), but at present I'm working on
expanding some of the "procedural language" components, such as a selection
statement, pointers, floating point type, etc.


My compiler is rather unsophisticated. It's recursive-descent with a scanner
and parser written "from scratch". It loosely follows Wirth's Oberon0 compiler
in his Compiler Construction book.


My plan is to have records remain as essentially fixed, compile-time entities,
so that they can be efficiently compiled. Classes, on the other hand, provide
polymorphism and the like. The classes are designed to provide more programmer
flexibility at the price of efficiency.


My question is this: Would variant records provide significant value to a user
of my language (given that classes were implemented)? My programming
experience has been that I frequently see unions in C code, but not very often
in C++ or Java (unless it's specifically to interface with C libraries). So if
I'm trying to keep my language (and compiler) fairly small, is there a good
case for variant records, or could everything be handled through classes
without too much inconvenience to the user programmer?


Post a followup to this message

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