|language design implications for variant records in a pascal-like lang email@example.com (noitalmost) (2010-12-22)|
|Re: language design implications for variant records in a pascal-like firstname.lastname@example.org (George Neuner) (2010-12-23)|
|Re: language design implications for variant records in a pascal-like email@example.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 firstname.lastname@example.org (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 email@example.com (Gene) (2010-12-27)|
|[59 later articles]|
|Date:||Wed, 22 Dec 2010 15:03:54 -0500|
|Posted-Date:||23 Dec 2010 11:12:52 EST|
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?
Return to the
Search the comp.compilers archives again.