[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Do you know of any forks of TinyCC?
From: |
Michael B. Smith |
Subject: |
Re: [Tinycc-devel] Do you know of any forks of TinyCC? |
Date: |
Wed, 11 May 2016 01:46:33 +0000 |
His commits remind me quite strongly of how I implemented C for Burroughs Corp.
mainframes in the 1980s.
I started with a very minimal compiler written in Extended ALGOL, then made it
self-hosting in C, then extended it, step-by-step, until it was a full compiler.
I took a different tack than FB did ... but different strokes, different folks.
Fun stuff.
-----Original Message-----
>> First commits to tinycc are from 2001
>>
>> http://repo.or.cz/tinycc.git/shortlog/18a8013fe71a63633948bc40412f7939fe34907d
>>
>> They are functional AFAICS, on i386.
>>
>> For example download a snapshot (7kB) from Fabrice Bellard's initial
>> revision
>>
>> http://repo.or.cz/tinycc.git/snapshot/27f6e16bae9d0f73acec07f61aea696
>> ab5adc680.tar.gz
>>
>> add this on top of tcc.c --------->
>> void expr(void);
>> void decl(int);
>> #ifdef _WIN32
>> #include <windows.h>
>> void *dlsym(int x, const char *func) {
>> return GetProcAddress(GetModuleHandle("msvcrt"), func);
>> }
>> #endif
>> <---------------------------------------
>>
>> compile:
>> $ gcc tcc.c -o tcc
>> or
>> $ cl -MD tcc.c
>>
>> create hello.c ------------------------->
>> #define HELLO "Hello!\n"
>> int main (int argc, char **argv)
>> {
>> int i;
>> printf(HELLO);
>> i = 0;
>> while (i < argc) {
>> printf("arg %d = %s\n", i, argv[i]);
>> i++;
>> }
>> return 0;
>> }
>> <---------------------------------------
>>
>> and run it:
>> $ tcc hello.c 111 222 333
>>
>> Hello!
>> arg 0 = hello.c
>> arg 1 = 111
>> arg 2 = 222
>> arg 3 = 333
>>
>> As you can see, it works. With preprocessor and all. ;)
>>
>> -- gr
>>
>>
>> On Fri, May 6, 2016 at 1:16 AM, <address@hidden> wrote:
>>> I want to understand how TCC works, in the way it is now it confuses
>>> me
>>>> greatly. Maybe you know of some forks that maybe dropped some of
>>>> it's features and made source a bit easier to understand? Or, maybe
>>>> I should look at some old enough commit, before TCC learned to
>>>> compile asm code, and things of this sort?
>>>>
_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
- Re: [Tinycc-devel] Inserting spaces in output from -E, (continued)
- [Tinycc-devel] Do you know of any forks of TinyCC?, mzlapq01, 2016/05/06
- Re: [Tinycc-devel] Do you know of any forks of TinyCC?, David Mertens, 2016/05/06
- Re: [Tinycc-devel] Do you know of any forks of TinyCC?, David Mertens, 2016/05/06
- Re: [Tinycc-devel] Do you know of any forks of TinyCC?, grischka, 2016/05/07
- Re: [Tinycc-devel] Do you know of any forks of TinyCC?, David Mertens, 2016/05/07
- Re: [Tinycc-devel] Do you know of any forks of TinyCC?, grischka, 2016/05/09
- Re: [Tinycc-devel] Do you know of any forks of TinyCC?,
Michael B. Smith <=
Re: [Tinycc-devel] Inserting spaces in output from -E, Edmund Grimley Evans, 2016/05/06