Re: new IL: C (sort of...).
- From: "Rod Pemberton" <do_not_have@xxxxxxxxxxxxx>
- Date: Wed, 10 Jun 2009 20:59:49 -0400
"cr88192" <cr88192@xxxxxxxxxxx> wrote in message
news:h0p4u5$k98$1@xxxxxxxxxxxxxxxxxxxx
however, to better fill the role (ok, mostly to reduce performancestructs
overhead), I considered making a few design changes/restrictions:
I have removed the preprocessor, as for now I will assume that any used
input will be "PP clean"...
I have considered deprecating typedef (the reason is that typedef adds a
good deal of complexity to the parser, as well as likely making it a good
deal slower);
I have also dropped/deprecated some other misc language features (enum, a
lot of the C99 additions, ...);
I may deprecate support for "inline" struct/union declarations (all
are declared toplevel, and may be referenced, but no struct bodies may
appear as part of a variable of function declaration);
all variable declarations will be at the top of the function;
functions may not be nested;
bitfields? floats? unions? multiple integer and char types? qualifiers?
volatile? const? void? void*?
I'd get rid of all those too... :-)
so, the questions here are:
do people think using C as the basis for an IL is a good idea?...
Many modern languages already do, don't they?
If you do, you'll be restricted to the functionality of that subset of C,
and to the Algol-like language concepts. You'll be restricted to the Unix
everything-as-a-file concept, etc.
Although I was using a FORTH-like IL (not anymore...), as were you - IIRC, I
really wouldn't want to try convert FORTH or LISP to C... I don't see them
as being similar enough to convert them optimally. I'd consider C as an IL
to be fine for FORTRAN, Pascal, or BASIC, etc. Of course, you'd need to
keep the floats for FORTRAN, at least.
C has the advantage that it can be implemented for the most part using very
basic ? concepts, such as addresses and pointers. However, C can be made
far more portable with slight extensions.
are some of my considered alterations (such as deprecating typedef)
reasonable?...
I don't know. I know that it's about the only way to extend C. If the
other language is very extendable, you might have some problems. The two
situations where I commonly use typedef is with structs to self-reference
the struct and to hide the code complexity of function pointers.
or, hypothetically, would anyone else target a C subset with these
alterations?...
Possibly. A high level C with extensions, like GCC, to a very simple
reduced C would be very useful, IMO. I know there is Necula's CIL (not to
be confused with MS CIL), but I haven't seen much else. There are a number
of ancient C compilers, like Small C, which could compile the output of the
C-to-C conversion. I think it would be good for OS development and embedded
development etc. It really depends on how many advanced features and
extensions you could convert into simple C. The idea of implementing a very
simple C language was popular back when C compilers weren't common or
widespread.
Rod Pemberton
.
- Follow-Ups:
- Re: new IL: C (sort of...).
- From: Harold Aptroot
- Re: new IL: C (sort of...).
- From: cr88192
- Re: new IL: C (sort of...).
- From: Rod Pemberton
- Re: new IL: C (sort of...).
- References:
- RFC: new IL: C (sort of...).
- From: cr88192
- RFC: new IL: C (sort of...).
- Prev by Date: Re: RFC: new IL: C (sort of...).
- Next by Date: Re: new IL: C (sort of...).
- Previous by thread: Re: new IL: C (sort of...).
- Next by thread: Re: new IL: C (sort of...).
- Index(es):
Relevant Pages
|