473,417 Members | 1,566 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,417 software developers and data experts.

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 help you to master the
C language.
Jun 27 '08
61 3181
CBFalconer said:
"no*************@gmail.com" wrote:
>"noagbodjivic...@gmail.com" <noagbodjivic...@gmail.comwrote:
>>dreamAnders <dream_and...@yahoo.com.cnwrote:

ucc is an ANSI C Compiler. Its code size is about 15,000 lines.
... snip ...
>>>
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?

You mean it isn't even written in C?
I don't see how you deduce that. It is precisely because it /is/ written in
C that you need a C compiler if you wish to compile it.
If so, that is the end of that project.
I don't see why. If I wanted to write a compiler for some arbitrary
language X, I'd almost certainly choose C to do it, rather than X. So why
someone else can't choose to write a C compiler in language X rather than
C is beyond me. And in any case, this C compiler /is/ written in C...

....except for one tiny annoying bit that uses an anonymous struct which, on
my system, halts compilation (using UCC's own makefile, so we can't blame
my martinet switches this time).

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 27 '08 #51
Richard Heathfield wrote:
CBFalconer said:
>"no*************@gmail.com" wrote:
>>"noagbodjivic...@gmail.com" <noagbodjivic...@gmail.comwrote:
dreamAnders <dream_and...@yahoo.com.cnwrote:

ucc is an ANSI C Compiler. Its code size is about 15,000 lines.
>
... snip ...
>>>>
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?

You mean it isn't even written in C?

I don't see how you deduce that. It is precisely because it /is/
written in C that you need a C compiler if you wish to compile it.
I asked a question, as indicated by the terminal '?'. If one
_needs_ some peculiar MS stuff to compile it, can it possibly be
written in C, as understood in this newsgroup?

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.

** Posted from http://www.teranews.com **
Jun 27 '08 #52
CBFalconer said:

<snip>
If one
_needs_ some peculiar MS stuff to compile it,
It doesn't. gcc compiles most of it just fine. My version barfs on
anonymous structs, but I guess I could go fix those if I cared enough.
can it possibly be
written in C, as understood in this newsgroup?
Modulo the anonymous structs, yes, sure. Why not take a look at the code
yourself?

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 27 '08 #53
On May 13, 1:18 am, rich...@cogsci.ed.ac.uk (Richard Tobin) wrote:
In article <ea49768e-6e7a-4426-a93b-e244eb978...@y18g2000pre.googlegroups.com>,

dreamAnders <dream_and...@yahoo.com.cnwrote:
Thank you very much for tesing the compiler. I have corrected the bugs.

That was quick!

But I still find the conditional operator doesn't work when the
second operand is 0 and the third is a pointer. (It now works
with them the other way round.)

I also have a problem with files that include sys/socket.h (this
is on Linux). I don't know if it's a problem with your compiler as
such or with the compatibility of the header files. I get this
error:

(/usr/include/bits/socket.h,165):error:Expect type specifier or qualifier
(/usr/include/bits/socket.h,165):error:Expect ;
(/usr/include/bits/socket.h,165):error:Expect type specifier or qualifier
(/usr/include/bits/socket.h,166):error:Undeclared identifier: __uint64_t

-- Richard
--
:wq
I checked the conditional operator problem and found the problem:a
typo error, shame me.
And for the socket.h, __uint64_t is the keyword in gcc, not in ucc.
Now ucc can't support 64bit.

And ucc does support a tricky method to work around these extensions
provided by gcc and vc.
If you will check the win32.c under driver, you will find the trick.

ucc can pass -keyword __uint64_t to ucl and add one line on the
keyword.h under ucl, the __uint64_t will work.
(Ugly, but now works)
Jun 27 '08 #54
dreamAnders said:

<snip>
>
I checked the conditional operator problem and found the problem:a
typo error, shame me.
No shame at all. Your attitude to bug reports is commendably positive.

Now, I know you like anonymous unions, and I understand that you want to
support them in your compiler, and that's fine - but *using* them in your
compiler prevents me from compiling the compiler itself, because /my/
compiler doesn't support them.

Is there any likelihood that you will be releasing a version of the code
that does not require the host compiler to support anonunions?

I understand that you don't currently supply headers or a library, relying
on the host environment to supply these. Again, that's fine - but if you
were to make your compiler's source code conform to ANSI C (and especially
to the 1989 ANSI (1990 ISO) Standard), you *might* find that some people
in comp.lang.c would be very willing to help you fill that gap.

<snip>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 27 '08 #55
On 5ÔÂ13ÈÕ, ÏÂÎç5ʱ00·Ö, Richard Heathfield <r...@see.sig.invalidwrote:
dreamAnders said:

<snip>
I checked the conditional operator problem and found the problem:a
typo error, shame me.

No shame at all. Your attitude to bug reports is commendably positive.

Now, I know you like anonymous unions, and I understand that you want to
support them in your compiler, and that's fine - but *using* them in your
compiler prevents me from compiling the compiler itself, because /my/
compiler doesn't support them.

Is there any likelihood that you will be releasing a version of the code
that does not require the host compiler to support anonunions?

I understand that you don't currently supply headers or a library, relying
on the host environment to supply these. Again, that's fine - but if you
were to make your compiler's source code conform to ANSI C (and especially
to the 1989 ANSI (1990 ISO) Standard), you *might* find that some people
in comp.lang.c would be very willing to help you fill that gap.

<snip>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999

That's great! I wish that some people in comp.lang.c to help me fill
that gap very much.
I will try to set up the developer community and evolve the project.
Jun 27 '08 #56


Richard Heathfield wrote:
I don't see why. If I wanted to write a compiler for some arbitrary
language X, I'd almost certainly choose C to do it, rather than X. So why
someone else can't choose to write a C compiler in language X rather than
C is beyond me.
C might not be the best language to implement a compiler in. C's weak typing
for example.

ucc is written in C as you have pointed out. It is an interesting project
that takes compilers back to some fundaments. Wenjun Wang is to be
commended for a nice piece of work.

Increasingly I expect we are going to see home grown Asian development
tools like ucc appearing.

Regards,

--
Walter Banks
Byte Craft Limited
Tel. (519) 888-6911
http://www.bytecraft.com
wa****@bytecraft.com




Jun 27 '08 #57
Richard Heathfield wrote:
CBFalconer said:

<snip>
>If one _needs_ some peculiar MS stuff to compile it,

It doesn't. gcc compiles most of it just fine. My version barfs on
anonymous structs, but I guess I could go fix those if I cared enough.
>can it possibly be written in C, as understood in this newsgroup?

Modulo the anonymous structs, yes, sure. Why not take a look at the
code yourself?
Well, I had it lined up to download, but when I saw the messages
about total lack of comment, and then need for MS stuff, I took it
down.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
** Posted from http://www.teranews.com **
Jun 27 '08 #58
On May 11, 11:41*am, "noagbodjivic...@gmail.com"
<noagbodjivic...@gmail.comwrote:
On May 11, 11:36*am, "noagbodjivic...@gmail.com"

<noagbodjivic...@gmail.comwrote:
On May 10, 9:15*pm, dreamAnders <dream_and...@yahoo.com.cnwrote:
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 help 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?
You guys are real pieces of work. (I've replied only to the most
egregious.) This is obviously an initial offering of a substantial
personal project with lots of potential. The code really is a marvel
of clarity. (It reminds me of http://www.t3x.org/bits/s9fes/. And I
commend the literate programming style/tools of s9fes to
dreamAnders.)

Give the guy a break. Celebrate the new resource and--if you see fit
to criticize--do so with contributions that fix the apparent bugs or
omissions.

Jeez...
Jun 27 '08 #59
On May 14, 8:32 am, Gene <gene.ress...@gmail.comwrote:
On May 11, 11:41 am, "noagbodjivic...@gmail.com"

<noagbodjivic...@gmail.comwrote:
On May 11, 11:36 am, "noagbodjivic...@gmail.com"
<noagbodjivic...@gmail.comwrote:
On May 10, 9:15 pm, dreamAnders <dream_and...@yahoo.com.cnwrote:
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 help 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?

You guys are real pieces of work. (I've replied only to the most
egregious.) This is obviously an initial offering of a substantial
personal project with lots of potential. The code really is a marvel
of clarity. (It reminds me ofhttp://www.t3x.org/bits/s9fes/. And I
commend the literate programming style/tools of s9fes to
dreamAnders.)

Give the guy a break. Celebrate the new resource and--if you see fit
to criticize--do so with contributions that fix the apparent bugs or
omissions.

Jeez...
Thanks a lot. The literate programming style/tools is interesting.
Jun 27 '08 #60
On May 13, 10:07 pm, CBFalconer <cbfalco...@yahoo.comwrote:
Richard Heathfield wrote:
CBFalconer said:
<snip>
If one _needs_ some peculiar MS stuff to compile it,
It doesn't. gcc compiles most of it just fine. My version barfs on
anonymous structs, but I guess I could go fix those if I cared enough.
can it possibly be written in C, as understood in this newsgroup?
Modulo the anonymous structs, yes, sure. Why not take a look at the
code yourself?

Well, I had it lined up to download, but when I saw the messages
about total lack of comment, and then need for MS stuff, I took it
down.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.

** Posted fromhttp://www.teranews.com**
Thank you for downloading. Well there is nearly no comments, but I
assure
you the code clarity is my important concern when writing the code.
I will add more comments later. When using on Windows, it needs MS
stuff.
btw, there are many students using MS stuff on China.

I need to set up a web about ucc as soon as possible. And I already
used subversion.
I hope there are people who will join the developer community to help
it grow.
Jun 27 '08 #61
dreamAnders wrote:
btw, there are many students using MS stuff on China.
Tell them to give Red Flag Linux a try.
http://en.wikipedia.org/wiki/Red_Flag_Linux
(Don't waste your time on MS stuff.)
Jun 27 '08 #62

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

Similar topics

5
by: Fuzzyman | last post by:
What's the score on this (the ASPN python compiler) - is it a true compiler for python ? - what does it output - binary or C++ for .NET framework............ if the latter then it could be very...
14
by: Mark Dufour | last post by:
After nine months of hard work, I am proud to introduce my baby to the world: an experimental Python-to-C++ compiler. It can convert many Python programs into optimized C++ code, without any user...
43
by: Anitha | last post by:
Hi I observed something while coding the other day: if I declare a character array as char s, and try to use it as any other character array..it works perfectly fine most of the times. It...
3
by: babak | last post by:
Hi I am running a project in eVC 4.0 and I have been running into a bug that only appears in the release build of the project. I eventually found out that when I had the compiler option /Od set...
11
by: zeppe | last post by:
Hi all, I've a problem. The code that follows creates a warning in both gcc and visual c++. However, I think it's correct: basically, there is a function that return an object of a derived...
8
by: STG | last post by:
Greetings, My group has an SDK that was developed 5 years ago with VC++ 6. Over the last years, the requests for a VS.NET SDK has reached critical mass and I am now in the process of doing that....
15
by: linq936 | last post by:
Hi, I am reading book <<Expert C Programming>>, it has the following quiz, a //* //*/ b In C and C++ compiler what does the above code trun out? I think it is simple for C compiler, it is...
49
by: valentin tihomirov | last post by:
fDeleted = false; uint jobId; foreach (Struct struct in structures) { if (struct.type == JOB) { jobId = struct.id; if (struct.dataType == STATUS) fDeteted = (struct.data & STATUS_DELETED) !=...
3
by: gil | last post by:
Hi, I'm trying to find the best way to work with compiler warnings. I'd like to remove *all* warnings from the code, and playing around with the warning level, I've noticed that compiling with...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.