473,382 Members | 1,376 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

An idea.

Hi!
I use Python, and writing some extension modules I think which could
be written an
C compiler, useful only to compile extension modules (I not think an
GCC!!!!), so that the user not have to use GCC, Microsoft Visual C++,
or other.
It must have an common API to all platforms, even if obviously the
implementation is various.
Could be write in 100% Python pure.

It is a bad idea?
Jul 18 '05 #1
7 2047
Am Wed, 21 Jul 2004 03:59:37 -0700 schrieb winlinch:
Hi!
I use Python, and writing some extension modules I think which could
be written an
C compiler, useful only to compile extension modules (I not think an
GCC!!!!), so that the user not have to use GCC, Microsoft Visual C++,
or other.
It must have an common API to all platforms, even if obviously the
implementation is various.
Could be write in 100% Python pure.

It is a bad idea?


Hi,

I like the idea very much. A C compiler
written in python. Someone already started
this. There was a post in this newsgroup,
maybe one month ago.

Regards,
Thomas

--
Thomas Güttler, http://www.thomas-guettler.de/
Jul 18 '05 #2
"Thomas Guettler" <gu*****@thomas-guettler.de> wrote in message news:<pa****************************@thomas-guettler.de>...
Am Wed, 21 Jul 2004 03:59:37 -0700 schrieb winlinch:
Hi!
I use Python, and writing some extension modules I think which could
be written an
C compiler, useful only to compile extension modules (I not think an
GCC!!!!), so that the user not have to use GCC, Microsoft Visual C++,
or other.
It must have an common API to all platforms, even if obviously the
implementation is various.
Could be write in 100% Python pure.

It is a bad idea?


Hi,

I like the idea very much. A C compiler
written in python. Someone already started
this. There was a post in this newsgroup,
maybe one month ago.


The link to this compiler is here:

http://people.cs.uchicago.edu/~varmaa/mini_c/

Another good idea would be to write an improved C preprocessor that

* is more consistent with the C language. For example,
macro SQUARE(x) = x * x;
would be equivalent to
#define SQUARE(x) ((x) * (x))
* in addition to MACRO and MACRO(args), allows forms as complex as:
macro NEW T[arraysize] = calloc(arraysize, sizeof(T));
macro NEW T(...) = T ## _new(...);
macro ALLOCATOR typename(...) {init} =
T* T##_new(...) {
T* self = malloc(sizeof(T));
init;
return self;
}
;
which would allow you to write code like
ALLOCATOR String(char *s) {
self->length = strlen(self);
self->data = NEW char[self->length + 1];
strcpy(self->data, s);
}
int foo() {
s = NEW String("Hello, world!");
// ...
}
* Has "typeof" as part of the preprocessor, so that code like
macro DESTRUCTOR T {cleanup} =
void T##_delete(T* self) {
cleanup;
free(self);
}
;
macro DELETE p = typeof(p)##_delete(p);
will work.
Jul 18 '05 #3
da*****@yahoo.com (Dan Bishop) wrote in message news:<ad**************************@posting.google. com>...
"Thomas Guettler" <gu*****@thomas-guettler.de> wrote in message news:<pa****************************@thomas-guettler.de>...
Am Wed, 21 Jul 2004 03:59:37 -0700 schrieb winlinch:
Hi!
I use Python, and writing some extension modules I think which could
be written an
C compiler, useful only to compile extension modules (I not think an
GCC!!!!), so that the user not have to use GCC, Microsoft Visual C++,
or other.
It must have an common API to all platforms, even if obviously the
implementation is various.
Could be write in 100% Python pure.

It is a bad idea?


Hi,

I like the idea very much. A C compiler
written in python. Someone already started
this. There was a post in this newsgroup,
maybe one month ago.


The link to this compiler is here:

http://people.cs.uchicago.edu/~varmaa/mini_c/

Another good idea would be to write an improved C preprocessor that

* is more consistent with the C language. For example,
macro SQUARE(x) = x * x;
would be equivalent to
#define SQUARE(x) ((x) * (x))
* in addition to MACRO and MACRO(args), allows forms as complex as:
macro NEW T[arraysize] = calloc(arraysize, sizeof(T));
macro NEW T(...) = T ## _new(...);
macro ALLOCATOR typename(...) {init} =
T* T##_new(...) {
T* self = malloc(sizeof(T));
init;
return self;
}
;
which would allow you to write code like
ALLOCATOR String(char *s) {
self->length = strlen(self);
self->data = NEW char[self->length + 1];
strcpy(self->data, s);
}
int foo() {
s = NEW String("Hello, world!");
// ...
}
* Has "typeof" as part of the preprocessor, so that code like
macro DESTRUCTOR T {cleanup} =
void T##_delete(T* self) {
cleanup;
free(self);
}
;
macro DELETE p = typeof(p)##_delete(p);
will work.


I have seen http://people.cs.uchicago.edu/~varmaa/mini_c/ and I must
say that is good, even if I thought to a compiler written without
other modules instead of standard library's, already useful.
For me, the idea of an improvements of C preprocessor has the
disadvantage of having to learn additional syntax, when instead can be
a compiler in the standard library.

I attend answers, critics and ideas!!!!
Jul 18 '05 #4
wi*******@yahoo.it wrote:
Hi!
I use Python, and writing some extension modules I think which could
be written an
C compiler, useful only to compile extension modules (I not think an
GCC!!!!), so that the user not have to use GCC, Microsoft Visual C++,
or other.
It must have an common API to all platforms, even if obviously the
implementation is various.
Could be write in 100% Python pure.

It is a bad idea?


What's the point? What's wrong with GCC? It's fast, comprehensive, and
supported on all major platforms. Unless it solves a specific task, like
Pysco or SWIG, it's purpose will be merely academic.
Jul 18 '05 #5
"Chris S." <ch*****@NOSPAMudel.edu> wrote in message news:<cd**********@scrotar.nss.udel.edu>...
wi*******@yahoo.it wrote:
Hi!
I use Python, and writing some extension modules I think which could
be written an
C compiler, useful only to compile extension modules (I not think an
GCC!!!!), so that the user not have to use GCC, Microsoft Visual C++,
or other.
It must have an common API to all platforms, even if obviously the
implementation is various.
Could be write in 100% Python pure.

It is a bad idea?


What's the point? What's wrong with GCC? It's fast, comprehensive, and
supported on all major platforms. Unless it solves a specific task, like
Pysco or SWIG, it's purpose will be merely academic.


The idea was that one to create a Python platform, without to use
large compilers (I refer above all to MSVC++!!!!!!!), but a compiler
part of the standard library to quickly compile a module.
Jul 18 '05 #6
wi*******@yahoo.it wrote:
The idea was that one to create a Python platform, without to use
large compilers (I refer above all to MSVC++!!!!!!!), but a compiler
part of the standard library to quickly compile a module.


But if it was capable of compiling any C extension module, it would have
to be a full-fledged (large!) C compiler.
Jul 18 '05 #7
On Tue, 27 Jul 2004, Leif K-Brooks wrote:
But if it was capable of compiling any C extension module, it would have
to be a full-fledged (large!) C compiler.


Not if it eschews most/all optimizations, obscure GCC/MSVC extensions,
full-blown assembler/linker, etc. It's quite possible to make a small C
compiler (tinycc (http://www.tinycc.org/) comes to mind...).

Jul 18 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Daniel Chartier | last post by:
Hello. I work in the paper industry and we recently had someone (the original author) from within the company make a program for preventive maintenance. However, it had some bugs and we wanted...
34
by: SeeBelow | last post by:
I see the value of a class when two or more instances will be created, but Python programmers regularly use a class when there will only be one instance. What is the benefit of this? It has a...
4
by: Luca | last post by:
Hello Everybody, I'm a 26 years old Italian "Florentine" Computer technician :) I'm writing you about an idea that I've got of a function that could be introduced in new web browsers (or even...
1
by: Lipei | last post by:
I have once try IntelliJ IDEA.And I can refactor easily,I can add try and catch just by a few clicks.It also can help me analazy the program's error.(e.g It warned me that I did't initialize the...
4
by: Jordan Marton | last post by:
Hi, I spent the entire weekend struggling to find a suitable tempalte solution for my site. Yes, user controls were good, but I needed one page that could control user controls on each adn every...
21
by: petermichaux | last post by:
Hi, I've been asking questions about library design over the last week and would like to get feedback on my overall idea for a JavaScript GUI library. I need a nice GUI library so there is a...
12
by: Paul H | last post by:
A little off topic this one because the database may not be written in Access. I am just looking for some advice.. I have an idea to help prevent a particular type of crime, a database will be...
28
by: onkar | last post by:
This idea might be vey crazy. But I hope to get answers to this .. from comp.lang.c If a compiler is designed such that it automatically adds a free() matching every malloc() then is it not a...
2
by: pigeonrandle | last post by:
Hi, My application creates a project that is structured like a tree, so i want to use a treeview to display it to the user. Would it be a good idea to create the various parts of project as...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.