Python Formatted C Converter (PfCC)

Glyph Lefkowitz glyph at no.spam
Mon Oct 23 01:44:31 EDT 2000


"Alex McHale" <daimun at home.com> writes:

>   The project is, as I call it, a Python Formatted C Converter.  What this
> means, is that it takes a python-style coded C program and converts it into
> compilable C code.  For example, consider this bastardized looking simple
> program below:

I have actually had very similiar ideas myself :) however, the project
I'm working on (still in its infantile stages; I basically have
'struct' working and nothing else) is not just to make a translator,
but to write a new language which allows C to be interfaced with other
languages.

The basic idea is to create a parser (not a preprocessor) which will
have most of the functionality of C built-in, then develop extensions
which can interface with other object-models available in C.  The
"compiler" (which generates C, C++, or Objective C code) is a
type-oriented language.

There would be built-in type-oriented polymorphism, and an
overloadable "." operator, making an explicit distinction between
run-time and compile-time dispatch.

Basically it's going to be a playground for certain theories I have
about object-orientation and high-level languages.  However, I have to
agree with the other posters in that writing *JUST* a preprocessor is
a bad idea.  At least make your preprocessor smart enough that it'll
spot errors in the code before it opts to generate the C; there are
few things more annoying than figuring out why the code will generate
OK, but the *generated* code won't compile.

(Also, there's the fact that C's syntax is actually pretty good for
doing what C does)

-- 
Glyph Lefkowitz
Professional -- Software Engineer,  Origin Systems
Amateur      -- Computer Scientist, Twisted Matrix Enterprises
(My opinions are my own and do not reflect in any way on the policies
or practices of my employer, etcetera etcetera.)



More information about the Python-list mailing list