|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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' |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
"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? |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#9 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#10 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#11 |
|
Messages: n/a
Hébergeur: |
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? |
|
|
|
#12 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#13 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#14 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#15 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#16 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#17 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#18 |
|
Messages: n/a
Hébergeur: |
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 . |
|
|
|
#19 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#20 |
|
Messages: n/a
Hébergeur: |
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 . |
|
|
|
#21 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#22 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#23 |
|
Messages: n/a
Hébergeur: |
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...) |
|
|
|
#24 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#25 |
|
Messages: n/a
Hébergeur: |
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. |
|
![]() |
| Outils de la discussion | |
|
|