[REBOL] learning to code... Re:

1999-12-30 Thread bo


t,

Do you like to write entertainment, utility, automation or some other type
of scripts?  Let us know and maybe we can give you some suggestions on
what to try to script :-)

On 28-Dec-1999/3:03:31+2:00, [EMAIL PROTECTED] 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



[REBOL] learning to code... Re:(2)

1999-12-30 Thread bo


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



[REBOL] learning to code... Re:(2)

1999-12-30 Thread hmf

[EMAIL PROTECTED] wrote:
 
 t,
 
 Do you like to write entertainment, utility, automation or some other type
 of scripts?  Let us know and maybe we can give you some suggestions on
 what to try to script :-)
 

Howdy Bo,

Well, for starters something that looks right. my little masterpieces
are u-g-l-y. (that's one reason I want an emacs mode to help me...)

I think, utility stuff.  like something that will loop thru my netscape
mail folder, strip the headers, and save each message as a file with the
first three words of the subject for the filename,

or something manipulate files on my web site that are updated every day,
without *any* intervention by me.
my scripts automate my daily chore (oh, I just modified one, and broke
it), but I still have to do more than I'd like...

also, I really do like the idea of a C or Java code generator.  I think
I'll go for Java in school (not this semester but next), because it's
probably easier than c or c++...right now I don't know java from a heap
of coffee grounds.  So the code generator may be a little above my head.

sorry for being so long-winded!
-- 


-t



[REBOL] learning to code... Re:

1999-12-28 Thread Al . Bri

t wrote:
 I've followed the "thanks" thread with interest, because I'm in a
similar boat to Petra's.  Probably next semester I'll start with C or
Java or somthing.

If you have the choice, choose Java or C++ first, then C later. Bjarne
Stroustrup recently pointed out that it's better for beginners to learn
C++ first, then C.

 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?

As Elan suggested, a REBOL language or dialect that generates Java or
C++ code would be interesting and would greatly increase your skill
level in that language and in REBOL.

Andrew Martin
[EMAIL PROTECTED]
http://members.xoom.com/AndrewMartin/
Online @ 33,600 Baud!
--