IIRC, Kernighan/Ritchey's C book also had a mini-C-compiler written in C in
the back.  This could be used as the basis for a JAVA to REBOL converter. :-)

On 28-Dec-1999/19:08:41-8:00, [EMAIL PROTECTED] wrote:
>Hi -t,
>
>why not write a C or Java source code generator in REBOL? 
>
>You'll have to learn what a Java or C source file looks like. Let's take C.
>
>Normally a C file is either a source code file, or a header file. A code
>file (typically filename.c) will begin by including some header files such as:
>
>stdio.h
>stdlib.h
>
>If you're programming is going to interact with sockets under Windows,
>it'll probably have to include winsock.h.
>
>Depending on what you are doing you may also include some other header
>files, like header files for database libraries, or, if you're programming
>under windows, you used to have to inlucde
>
>windows.h
>
>So, the begining of your source code file may look like this:
>
>#include <stdio.h>
>#include <stdlib.h>
>#include <windows.h>
>#include <winsock.h>
>
>Then you may define some constants, for instance
>
>#define MY_LOGIN_NAME "icimjs"
>#define MY_PASSWORD   "********"
>#define TRIES         10
>#define FTP_OPORT     21
>#define FTP_IPORT     22
>
>and typedefs, such as
>
>#typedef char * NODE
>
>or something like that. Next you may declare variables and functions that
>will be globally accessable, or you may declare them static to ensure that
>they remain limited to the source file.
>
>To find out the details, grab a good book on C programming. I still think
>Kernighan/Ritchie's book on C Programming is the best introcutory around.
>
>Then you can build yourself REBOL objects that will generate the code and
>the different files you need for you.
>
>The point is that as you read through the book and try out the examples,
>you summarize in your mind the repeating patterns of header files and
>function declarations and so on, and you use that information to implement
>REBOL objects and functions that will take some arguments or set some
>words, which will the be used to generate file which contains the proper C
>code.
>
>While you think about how to structure your REBOL program you will be
>intesively dealing with the structure of C programs that is the data you
>are trying generate using REBOL. By the time you've got your REBOL C case
>tool completed, I bet you'll be quite some C expert and at the same time
>your efforts will pay you back by providing you with a tool that guarantees
>that a good portion of your code will be syntactically correct.
>
>Basically, REBOL becomes a tool, that use in order to think about C
>programs and with which test your own theories about how C programs,
>functions, constants, structures, and variables are declared and defined.
>
>You would be creating a REBOL dialect that allows to discuss C programs
>with REBOL and - if its well done - will allow you use REBOL as your
>assistant in creating C programs. Kind of a C programming metalanguage, or
>a compiler for your own language, whose target language is C.
>
>You can then look at specific programming tasks. What do linked lists look
>like in C. How can you create a REBOL function that generates C code that
>will declare and define the necessary data structures and supporting
>structures for generic linked list structure?
>
>Whenever you investigate a language for the purpose of creating a tool to
>support the language, you become for more intimate with the language your
>investigating, then when you're just trying to keep up with the curriculum. 
>
>Elan
>
>
>At 03:03 AM 12/28/99 +0200, you wrote:
>>Hi guys,
>>
>>I've followd the "thanks" thread with intrest, because I'm in a similiar
>>boat to Petra's.  Probably next semester I'll start with C or Java or
>>somthing.
>>
>>So Rebol won't ruin me for other languages, but instead help me
>>understand them?  I'm already loyal to REBOL (its got a very high "cool"
>>rating).  But I think I have to really dive in to it to learn it.  I've
>>written two funcional scripts, but I'm out of stuff to do.
>>
>>any ideas about how I can creep up the learning curve?
>>-- 
>>
>>
>>-t
>>
>>
>>
>
-- 
                           Bohdan "Bo" Lechnowsky
                           REBOL  Adventure Guide
           REBOL Technologies 707-467-8000 (http://www.rebol.com)
          Download the REBOL Messaging Language for all Platforms

Reply via email to