PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.c > Introduce a C Compiler ucc
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Introduce a C Compiler ucc

Réponse
 
LinkBack Outils de la discussion
Vieux 11/05/2008, 02h15   #1
dreamAnders
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Introduce a C Compiler ucc

ucc is an ANSI C Compiler. Its code size is about 15,000 lines.
The lexer, parser and code generator are all hand-written.
The code structure is very clear and straightforward. And there is an
interesting value numbering algorithm.
It also has a document explaining the internal implementation.
If you are interested at this compiler, you can download it from
http://sourceforge.net/projects/ucc, which will you to master the
C language.
  Réponse avec citation
Vieux 11/05/2008, 02h35   #2
vippstar@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Introduce a C Compiler ucc

On May 11, 4:15 am, dreamAnders <dream_and...@yahoo.com.cn> wrote:
> ucc is an ANSI C Compiler. Its code size is about 15,000 lines.
> The lexer, parser and code generator are all hand-written.
> The code structure is very clear and straightforward. And there is an
> interesting value numbering algorithm.
> It also has a document explaining the internal implementation.
> If you are interested at this compiler, you can download it fromhttp://sourceforge.net/projects/ucc, which will you to master the
> C language.


Your implementation of assert in ucc/ucl/linux/include/assert.h is not
ANSI C, (or ISO C) as it evaluates it's parameter more than once if
NDEBUG is not defined.
Example: assert(printf("hello world\n")); would call print twice.

I suggest you rewrite _assert (and also rename to _Assert) to return
void, and make the check twice there.
  Réponse avec citation
Vieux 11/05/2008, 02h42   #3
Robert Gamble
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Introduce a C Compiler ucc

On May 10, 9:15 pm, dreamAnders <dream_and...@yahoo.com.cn> wrote:
> ucc is an ANSI C Compiler. Its code size is about 15,000 lines.
> The lexer, parser and code generator are all hand-written.
> The code structure is very clear and straightforward. And there is an
> interesting value numbering algorithm.
> It also has a document explaining the internal implementation.
> If you are interested at this compiler, you can download it fromhttp://sourceforge.net/projects/ucc, which will you to master the
> C language.


At about 1 comment per 1000 lines of code it may be difficult to get
this adopted for "research and instructional use".

--
Robert Gamble
  Réponse avec citation
Vieux 11/05/2008, 03h21   #4
dreamAnders
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Introduce a C Compiler ucc

On May 11, 9:35 am, vipps...@gmail.com wrote:
> On May 11, 4:15 am, dreamAnders <dream_and...@yahoo.com.cn> wrote:
>
> > ucc is an ANSI C Compiler. Its code size is about 15,000 lines.
> > The lexer, parser and code generator are all hand-written.
> > The code structure is very clear and straightforward. And there is an
> > interesting value numbering algorithm.
> > It also has a document explaining the internal implementation.
> > If you are interested at this compiler, you can download it fromhttp://sourceforge.net/projects/ucc, which will you to master the
> > C language.

>
> Your implementation of assert in ucc/ucl/linux/include/assert.h is not
> ANSI C, (or ISO C) as it evaluates it's parameter more than once if
> NDEBUG is not defined.
> Example: assert(printf("hello world\n")); would call print twice.
>
> I suggest you rewrite _assert (and also rename to _Assert) to return
> void, and make the check twice there.


No, It will not evaluate its parameter more than once.

#define assert(e) ((void)((e)||_assert(#e, __FILE__, __LINE__)))

please notice that the second e's appearance, it is '#e'
  Réponse avec citation
Vieux 11/05/2008, 03h24   #5
dreamAnders
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Introduce a C Compiler ucc

yes, I accept this . Nearly no comments. I wanted to write this code
in a self-explanatory way. And I provide an internal implementation
document, hope that will developers understanding the code.

On May 11, 9:42 am, Robert Gamble <rgambl...@gmail.com> wrote:
> On May 10, 9:15 pm, dreamAnders <dream_and...@yahoo.com.cn> wrote:
>
> > ucc is an ANSI C Compiler. Its code size is about 15,000 lines.
> > The lexer, parser and code generator are all hand-written.
> > The code structure is very clear and straightforward. And there is an
> > interesting value numbering algorithm.
> > It also has a document explaining the internal implementation.
> > If you are interested at this compiler, you can download it fromhttp://sourceforge.net/projects/ucc, which will you to master the
> > C language.

>
> At about 1 comment per 1000 lines of code it may be difficult to get
> this adopted for "research and instructional use".
>
> --
> Robert Gamble



  Réponse avec citation
Vieux 11/05/2008, 04h20   #6
Dan
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Introduce a C Compiler ucc


"dreamAnders" <dream_anders@yahoo.com.cn> wrote in message
news:1b33b933-749a-48ca-af4f-d7f87f8ebc37@p25g2000pri.googlegroups.com...
> ucc is an ANSI C Compiler. Its code size is about 15,000 lines.
> The lexer, parser and code generator are all hand-written.
> The code structure is very clear and straightforward. And there is an
> interesting value numbering algorithm.
> It also has a document explaining the internal implementation.
> If you are interested at this compiler, you can download it from
> http://sourceforge.net/projects/ucc, which will you to master the
> C language.


Can it compile itself?


  Réponse avec citation
Vieux 11/05/2008, 04h42   #7
Gene
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Introduce a C Compiler ucc

On May 10, 11:20pm, "Dan" <vo...@sometwher.world> wrote:
> "dreamAnders" <dream_and...@yahoo.com.cn> wrote in message
>
> news:1b33b933-749a-48ca-af4f-d7f87f8ebc37@p25g2000pri.googlegroups.com...
>
> > ucc is an ANSI C Compiler. Its code size is about 15,000 lines.
> > The lexer, parser and code generator are all hand-written.
> > The code structure is very clear and straightforward. And there is an
> > interesting value numbering algorithm.
> > It also has a document explaining the internal implementation.
> > If you are interested at this compiler, you can download it from
> >http://sourceforge.net/projects/ucc, which will you to master the
> > C language.

>
> Can it compile itself?


From User's Manual:

(3) run make test, this will test if ucc can compile itself and run
successfully.
The command performs the following operations:
1) use ucc to build ucl, the output is named as ucl1
2) backup ucl under /usr/local/lib/ucc, copy ucl1 to this
directory and rename it to ucl
3) use ucc to build ucl again, the output is named as ucl2
4) run cmp /b ucl1 ucl2, these two files should be identical
  Réponse avec citation
Vieux 11/05/2008, 11h21   #8
Rui Maciel
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Introduce a C Compiler ucc

On Sat, 10 May 2008 18:15:57 -0700, dreamAnders wrote:

> ucc is an ANSI C Compiler. Its code size is about 15,000 lines. The
> lexer, parser and code generator are all hand-written. The code
> structure is very clear and straightforward. And there is an interesting
> value numbering algorithm. It also has a document explaining the
> internal implementation. If you are interested at this compiler, you can
> download it from http://sourceforge.net/projects/ucc, which will
> you to master the C language.


Do you have a site dedicated to your project?


Rui Maciel
  Réponse avec citation
Vieux 11/05/2008, 14h52   #9
Bart
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Introduce a C Compiler ucc

On May 11, 2:15am, dreamAnders <dream_and...@yahoo.com.cn> wrote:
> ucc is an ANSI C Compiler. Its code size is about 15,000 lines.
> The lexer, parser and code generator are all hand-written.
> The code structure is very clear and straightforward. And there is an
> interesting value numbering algorithm.
> It also has a document explaining the internal implementation.
> If you are interested at this compiler, you can download it fromhttp://sourceforge.net/projects/ucc, which will you to master the
> C language.


As I understand it, this is just a bare compiler source code?

There are no binaries, so another compiler is needed to get started.

There appear to be no standard header files or library files,
presumably you are relying on these things from another compiler?


--
Bartc
  Réponse avec citation
Vieux 11/05/2008, 16h36   #10
noagbodjivictor@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Introduce a C Compiler ucc

On May 10, 9:15pm, dreamAnders <dream_and...@yahoo.com.cn> wrote:
> ucc is an ANSI C Compiler. Its code size is about 15,000 lines.
> The lexer, parser and code generator are all hand-written.
> The code structure is very clear and straightforward. And there is an
> interesting value numbering algorithm.
> It also has a document explaining the internal implementation.
> If you are interested at this compiler, you can download it fromhttp://sourceforge.net/projects/ucc, which will you to master the
> C language.


Congratulations. I hope this project will evolve quickly.
  Réponse avec citation
Vieux 11/05/2008, 16h41   #11
noagbodjivictor@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Introduce a C Compiler ucc

On May 11, 11:36am, "noagbodjivic...@gmail.com"
<noagbodjivic...@gmail.com> wrote:
> On May 10, 9:15pm, dreamAnders <dream_and...@yahoo.com.cn> wrote:
>
> > ucc is an ANSI C Compiler. Its code size is about 15,000 lines.
> > The lexer, parser and code generator are all hand-written.
> > The code structure is very clear and straightforward. And there is an
> > interesting value numbering algorithm.
> > It also has a document explaining the internal implementation.
> > If you are interested at this compiler, you can download it fromhttp://sourceforge.net/projects/ucc, which will you to master the
> > C language.

>
> Congratulations. I hope this project will evolve quickly.


Also, I don't really like the fact that one must have Ms Studio to
compile the compiler Can't you distribute binaries?
  Réponse avec citation
Vieux 11/05/2008, 21h13   #12
Ian Collins
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Introduce a C Compiler ucc

dreamAnders wrote:
> ucc is an ANSI C Compiler. Its code size is about 15,000 lines.
> The lexer, parser and code generator are all hand-written.
> The code structure is very clear and straightforward. And there is an
> interesting value numbering algorithm.
> It also has a document explaining the internal implementation.
> If you are interested at this compiler, you can download it from
> http://sourceforge.net/projects/ucc, which will you to master the
> C language.


Your files all have DOS line endings, not good for a cross platform project.

--
Ian Collins.
  Réponse avec citation
Vieux 11/05/2008, 21h59   #13
Ian Collins
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Introduce a C Compiler ucc

Ian Collins wrote:
> dreamAnders wrote:
>> ucc is an ANSI C Compiler. Its code size is about 15,000 lines.
>> The lexer, parser and code generator are all hand-written.
>> The code structure is very clear and straightforward. And there is an
>> interesting value numbering algorithm.
>> It also has a document explaining the internal implementation.
>> If you are interested at this compiler, you can download it from
>> http://sourceforge.net/projects/ucc, which will you to master the
>> C language.

>
> Your files all have DOS line endings, not good for a cross platform project.
>

I see you also used unnamed unions in structs, which isn't standard.

You really should use standard C for a standard C compiler!

--
Ian Collins.
  Réponse avec citation
Vieux 11/05/2008, 23h50   #14
Richard Tobin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Introduce a C Compiler ucc

In article <68p513F2uactrU3@mid.individual.net>,
Ian Collins <ian-news@hotmail.com> wrote:
>You really should use standard C for a standard C compiler!


Why? Would it be wrong to write a C compiler in, say, Lisp? The
considerations for what language or dialect to use for a C compiler
are no stricter than for any other project. In fact, they're less
strict, since so long as you support the extensions you use you can be
sure that there's a compiler that will compile it for the platforms
you support.

-- Richard
--
:wq
  Réponse avec citation
Vieux 11/05/2008, 23h52   #15
Ian Collins
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Introduce a C Compiler ucc

Richard Tobin wrote:
> In article <68p513F2uactrU3@mid.individual.net>,
> Ian Collins <ian-news@hotmail.com> wrote:
>> You really should use standard C for a standard C compiler!

>
> Why? Would it be wrong to write a C compiler in, say, Lisp? The
> considerations for what language or dialect to use for a C compiler
> are no stricter than for any other project. In fact, they're less
> strict, since so long as you support the extensions you use you can be
> sure that there's a compiler that will compile it for the platforms
> you support.
>

Why? Because one of the claims for the source was it "will you to
master the C language."

Maybe that should read "will you to master the gcc language."

--
Ian Collins.
  Réponse avec citation
Vieux 12/05/2008, 01h04   #16
Rui Maciel
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Introduce a C Compiler ucc

On Sun, 11 May 2008 22:50:56 +0000, Richard Tobin wrote:

> Why? Would it be wrong to write a C compiler in, say, Lisp?


I believe that you've entirely missed the point. What was pointed out was
that the use of a non-standard extensions, which not only goes against
the objective that you set yourself to accomplish but also needlessly
screws things up for those who want to build it with any compiler that
doesn't support those non-standard extensions.


Rui Maciel
  Réponse avec citation
Vieux 12/05/2008, 09h38   #17
Richard Tobin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Introduce a C Compiler ucc

In article <68pbluF2uactrU4@mid.individual.net>,
Ian Collins <ian-news@hotmail.com> wrote:

>Why? Because one of the claims for the source was it "will you to
>master the C language."


Fair enough, but you said something far more general:

>>> You really should use standard C for a standard C compiler!


-- Richard


--
:wq
  Réponse avec citation
Vieux 12/05/2008, 11h08   #18
dreamAnders
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Introduce a C Compiler ucc

On May 11, 11:41pm, "noagbodjivic...@gmail.com"
<noagbodjivic...@gmail.com> wrote:
> On May 11, 11:36am, "noagbodjivic...@gmail.com"
>
> <noagbodjivic...@gmail.com> wrote:
> > On May 10, 9:15pm, dreamAnders <dream_and...@yahoo.com.cn> wrote:

>
> > > ucc is an ANSI C Compiler. Its code size is about 15,000 lines.
> > > The lexer, parser and code generator are all hand-written.
> > > The code structure is very clear and straightforward. And there is an
> > > interesting value numbering algorithm.
> > > It also has a document explaining the internal implementation.
> > > If you are interested at this compiler, you can download it fromhttp://sourceforge.net/projects/ucc, which will you to master the
> > > C language.

>
> > Congratulations. I hope this project will evolve quickly.

>
> Also, I don't really like the fact that one must have Ms Studio to
> compile the compiler Can't you distribute binaries?


Thanks. I am afraid that ucc is a stand-alone compiler. On Windows, It
rely on VC'header
files, library files, the preprocessor,assembler and linker. On Linux,
It rely on gcc
for that. So If I distribute binaries, users will find it cannot work.

I hope the project will evolve quickly. I need more .
  Réponse avec citation
Vieux 12/05/2008, 11h10   #19
dreamAnders
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Introduce a C Compiler ucc

On May 12, 4:13am, Ian Collins <ian-n...@hotmail.com> wrote:
> dreamAnders wrote:
> > ucc is an ANSI C Compiler. Its code size is about 15,000 lines.
> > The lexer, parser and code generator are all hand-written.
> > The code structure is very clear and straightforward. And there is an
> > interesting value numbering algorithm.
> > It also has a document explaining the internal implementation.
> > If you are interested at this compiler, you can download it from
> >http://sourceforge.net/projects/ucc, which will you to master the
> > C language.

>
> Your files all have DOS line endings, not good for a cross platform project.
>
> --
> Ian Collins.


Thank you for your suggestion.

And yes, ucc supports anonymous union. Personally, I like anonymous
union so much,
and most compilers support it. So I want to support it too.
  Réponse avec citation
Vieux 12/05/2008, 11h17   #20
dreamAnders
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Introduce a C Compiler ucc

On May 11, 11:41pm, "noagbodjivic...@gmail.com"
<noagbodjivic...@gmail.com> wrote:
> On May 11, 11:36am, "noagbodjivic...@gmail.com"
>
> <noagbodjivic...@gmail.com> wrote:
> > On May 10, 9:15pm, dreamAnders <dream_and...@yahoo.com.cn> wrote:

>
> > > ucc is an ANSI C Compiler. Its code size is about 15,000 lines.
> > > The lexer, parser and code generator are all hand-written.
> > > The code structure is very clear and straightforward. And there is an
> > > interesting value numbering algorithm.
> > > It also has a document explaining the internal implementation.
> > > If you are interested at this compiler, you can download it fromhttp://sourceforge.net/projects/ucc, which will you to master the
> > > C language.

>
> > Congratulations. I hope this project will evolve quickly.

>
> Also, I don't really like the fact that one must have Ms Studio to
> compile the compiler Can't you distribute binaries?


Thanks. I am afraid that ucc is not a stand-alone compiler. On
Windows, It
rely on VC'header files, library files, the preprocessor,assembler and
linker. On Linux, It rely on gcc for that. So If I distribute
binaries, users will find it cannot work.

I hope the project will evolve quickly. I need more .
  Réponse avec citation
Vieux 12/05/2008, 11h21   #21
dreamAnders
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Introduce a C Compiler ucc

On May 12, 4:13am, Ian Collins <ian-n...@hotmail.com> wrote:
> dreamAnders wrote:
> > ucc is an ANSI C Compiler. Its code size is about 15,000 lines.
> > The lexer, parser and code generator are all hand-written.
> > The code structure is very clear and straightforward. And there is an
> > interesting value numbering algorithm.
> > It also has a document explaining the internal implementation.
> > If you are interested at this compiler, you can download it from
> >http://sourceforge.net/projects/ucc, which will you to master the
> > C language.

>
> Your files all have DOS line endings, not good for a cross platform project.
>
> --
> Ian Collins.


Thank you for your suggestion.

Personally, I like unnamned union in structs so much and most
compilers support it. So I want to support it too.
  Réponse avec citation
Vieux 12/05/2008, 12h56   #22
Bart
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Introduce a C Compiler ucc

On May 12, 11:21am, dreamAnders <dream_and...@yahoo.com.cn> wrote:
> On May 12, 4:13am, Ian Collins <ian-n...@hotmail.com> wrote:


> > Your files all have DOS line endings, not good for a cross platform project.


So what line ending should be used for a cross-pltform project?

What /is/ a DOS line ending anyway?

> Personally, I like unnamned union in structs so much and most
> compilers support it. So I want to support it too.


Well said.

There's a whole bunch of these minor but extremely useful little
extensions, that really should be available on every compiler. And
they should be available now, no excuses.

--
Bartc
  Réponse avec citation
Vieux 12/05/2008, 14h14   #23
Kenny McCormack
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Introduce a C Compiler ucc

In article <725446e5-4533-42f1-8df9-8492b702a724@25g2000hsx.googlegroups.com>,
Bart <bc@freeuk.com> wrote:
>On May 12, 11:21am, dreamAnders <dream_and...@yahoo.com.cn> wrote:
>> On May 12, 4:13am, Ian Collins <ian-n...@hotmail.com> wrote:

>
>> > Your files all have DOS line endings, not good for a cross platform
>> > project.

>
>So what line ending should be used for a cross-pltform project?
>
>What /is/ a DOS line ending anyway?
>
>> Personally, I like unnamned union in structs so much and most
>> compilers support it. So I want to support it too.

>
>Well said.
>
>There's a whole bunch of these minor but extremely useful little
>extensions, that really should be available on every compiler. And
>they should be available now, no excuses.


Uh Oh.

(You're going to get it now...)

  Réponse avec citation
Vieux 12/05/2008, 14h45   #24
santosh
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Introduce a C Compiler ucc

Bart wrote:

> On May 12, 11:21am, dreamAnders <dream_and...@yahoo.com.cn> wrote:
>> On May 12, 4:13am, Ian Collins <ian-n...@hotmail.com> wrote:

>
>> > Your files all have DOS line endings, not good for a cross platform
>> > project.

>
> So what line ending should be used for a cross-pltform project?
>
> What /is/ a DOS line ending anyway?


It's the ASCII sequence CR-LF, i.e., the ASCII character code 13
followed by the ASCII character code 10. It's the standard line
separator under CP/M, DOS and Windows; maybe other system too.

The Unix world just uses a LF and MacOS uses just a CR. There are
utilities availbale to convert a file between these formats. It's also
trivial to write a standard C program to do the job.

  Réponse avec citation
Vieux 12/05/2008, 14h50   #25
noagbodjivictor@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Introduce a C Compiler ucc

On May 12, 7:56am, Bart <b...@freeuk.com> wrote:
> On May 12, 11:21am, dreamAnders <dream_and...@yahoo.com.cn> wrote:
>
> > On May 12, 4:13am, Ian Collins <ian-n...@hotmail.com> wrote:
> > > Your files all have DOS line endings, not good for a cross platform project.

>
> So what line ending should be used for a cross-pltform project?
>
> What /is/ a DOS line ending anyway?
>
> > Personally, I like unnamned union in structs so much and most
> > compilers support it. So I want to support it too.

>
> Well said.
>
> There's a whole bunch of these minor but extremely useful little
> extensions, that really should be available on every compiler. And
> they should be available now, no excuses.
>
> --
> Bartc


Windows/Dos : \n\r
Unix/Linux : \n
Mac OS X : \r

OS makers want us to believe this... and we are believers.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 06h18.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,36957 seconds with 33 queries