Why is Rexx hard to compile. 
Author Message
 Why is Rexx hard to compile.

What exactly is so difficult about compiling REXX.

djs.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
My own opinions and only my opinion.
David J. Simons                                       ProTel Inc.

801-461-3514                                          SLC  UT,  84105
fax 461-3530
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Sat, 18 Oct 1997 03:00:00 GMT  
 Why is Rexx hard to compile.

Quote:

>What exactly is so difficult about compiling REXX.

>djs.

    What do you mean. Last time I compiled a REXX program on VM... I did
a REXXC filename. That seemed pretty easy to me.

73's  de  Jack   -  kf5mg



WEB              -  http://www.metronet.com/~kf5mg    -     for voice mail.

+=========================================================================+
+     I am Homer of Borg.... prepare to be assim... oooo... Donuts...     +
+=========================================================================+



Sat, 18 Oct 1997 03:00:00 GMT  
 Why is Rexx hard to compile.

Quote:

>>What exactly is so difficult about compiling REXX.

I can think of three reasons REXX is difficult to compile:

1) The math is precisely defined and does not match any existing chipset.
Thus all math will be done by library.

2) The set of known variables is not known at compile time, so space for
variables cannot be preallocated, thus references must be "interpreted".

3) The INTERPRET instruction can force the execution of arbitrary code.

Sorry this is so puny, but many REXXperts are at SLAC today for the
symposium.   Dave




Sat, 18 Oct 1997 03:00:00 GMT  
 Why is Rexx hard to compile.

Quote:
>What exactly is so difficult about compiling REXX.

The problem is that compiling can take care of only 60% (pick a number ...
40%? ...) of the logic.  Since Rexx variables are untyped there is a lot
of processing that *has to* be done at run-time.  A compiled Rexx program
probably still looks like a lot of subroutine calls strung together or
is psuedo-code that is still interpreted.  Also there is the 'interpret'
instruction, etc. that cannot be compiled at all.

--------

Systems Programmer -- Team OS/2
NYS Legislative Bill Drafting Commission
1450 Western Avenue, 3rd floor
Albany, NY 12203
Voice:(518)458-5114  FAX:(518)458-5108

"Help stamp out slogans in signature files"



Sat, 18 Oct 1997 03:00:00 GMT  
 Why is Rexx hard to compile.
Hello,

I think what you are asking is why it is so difficult to write a compiler
for the REXX language.  Languages that are primarily string based such
as REXX, Icon, Snobol, etc. are harder to write good compilers for because
they require a lot of dynamic allocation of memory.  You can write a
compiler for this type of language, but I think that in most cases they
are best left interpreted.  It is much easier and less costly to write a
compiler for C or Pascal.  These languages have more regular typecasting
conventions and translate efficently into machine language.

I am not sure that it is as critical as it once was to compile every
program.  I have been working with computers since the late seventies and
have traditionally compiled all my programs, both recreational and research.
I love well structured, tight, compiled code.  You can get great performance
enhancement with a little extra work.  However, in my area of research I find
that the benefits of using built-in features and the fast prototyping of
interpreted languages outweighs the time I would spend getting the last
nanosecond of preformance from a program.

I have used C and Pascal for a lot of text analysis and bibliographic
database work.  Today I have a REXX interpreter and BASIC interpreters that
allow me to work at a higher level and save time.  I have a relatively
slow machine (486 66mhz) and run a fairly primitive operating system
(PC DOS 7.0/Windows 3.11) yet I can produce better looking programs that don't
appear to have lost that much in speed.  Using a program I downloaded from
the 'net I found that I can process 11640 clauses per second in DOS and
8242 clauses per second in a Windows DOS box.  That is plenty fast enough
for the kind of work I do and for most vertical market applications that are
not mission critical.

Mission critical and commercial mass market programs still need to compile
their code.  But for the humanities researcher and the vertical market
programmer interpreted languages (including CA-REALIZER and Visual Basic)
have become useful tools again.

I am looking forward to a new PowerPC based AIX machine.  It will be used
primarily to run our online catalog, but I would like to port some of my
new REXX-based development to it.  Has anyone here run the REXXCPS
benchmark program on the AIX version of REXX.  Could you tell me the
results?  Just curious.

                                        David Paul Bunnell
                                        Public Services Librarian/
                                        Assistant Professor
                                        Thomas Byrne Memorial Library
                                        Spring Hill College
                                        Mobile, AL  36608


                                        phone: (334) 380-3873
                                          fax: (334) 460-2086



Sat, 18 Oct 1997 03:00:00 GMT  
 Why is Rexx hard to compile.

Quote:
>What exactly is so difficult about compiling REXX.

The problem isn't that REXX is hard to compile -- it is that
it is hard to make compiled REXX perform significantly better
than interpreted REXX. There are lots of reasons for this,
here are some examples, and I'm sure others will offer more:

There is an essentially infinite pool of variables -- you can create new
ones with a stem (a.i, where i can be any string) or with the INTERPRET
instruction. This means that the full symbol table (usually a tree of some
sort) must be maintained dynamically in the compiled version, just as it
would be in the interpreted version.

REXX string can be of any length, unlike some other languages (fortran
and, COBOL, at least in the versions I programmed long ago).

There is no variable typing. In a compiler

int i, j, k
i = j + k

requires only the hardware integer add instruction (and maybe some
register loads and stores, depending on machine architecture). In REXX,

i = j + k

requires first converting j and k from string to integer or real, then
adding, then converting back to string to store in i.  In practice, you
can store data in binary form, and only convert it back when it is
required as a string, via a flag in the symbol table, but this still
requires housekeeping and frequent conversion.

REXX supports any number of numeric digits of precision.

In the nonstrict comparison operations (<, >, =, \=. <=. >=), what
operation is performed depends on whether both operands can be interpreted
as numbers or not.

It is possible to CALL, SIGNAL, and fall into the same code.

You are allowed to modify the loop index inside the loop.

INTERPRET requires nearly full access to the interpreter, even from a
compiled program. TRACE and SOURCELINE() require storing the complete
program source along with the compiled version, making the compiled
version rather large.
Alan Ackerman, 510-675-4358,



Sun, 19 Oct 1997 03:00:00 GMT  
 Why is Rexx hard to compile.
Also note that REXX under OS/2 is tokenized (in the extended attributes),
the first time it's executed. This takes some of the performance gains
of compiling away. But if you really need good performance than
coding in C is the best alternative, specially for processor bound
programs.




Sun, 19 Oct 1997 03:00:00 GMT  
 Why is Rexx hard to compile.
On Tue, 2 May 1995 11:59:02 -0500 David Paul Bunnell said:

Quote:
>I am looking forward to a new PowerPC based AIX machine.  It will be used
>primarily to run our online catalog, but I would like to port some of my
>new REXX-based development to it.  Has anyone here run the REXXCPS
>benchmark program on the AIX version of REXX.  Could you tell me the
>results?  Just curious.

RS/6000 PS-580 AIX 3.2.5
IBM Rexx/6000  'REXSAA 4.00 10 Nov 1993'
49,153 REXX clauses per second (average of 5 trials)
Each test run with 5 measures of 3 iterations.

This really flies! But even here I have developed/prototyped code in
REXX and then re-written it in C for a big performance boost.
I am working with over 1GB of text files, however.

--------

Systems Programmer -- Team OS/2
NYS Legislative Bill Drafting Commission
1450 Western Avenue, 3rd floor
Albany, NY 12203
Voice:(518)458-5114  FAX:(518)458-5108

"Help stamp out slogans in signature files"



Sun, 19 Oct 1997 03:00:00 GMT  
 Why is Rexx hard to compile.

Quote:

>What exactly is so difficult about compiling REXX.

Nothing, there just doesn't seem much point since there's so much run-time
stuff and arithmetic is defined at the character level. The chapter in The REXX
Handbook on the CMS compiler shows that that finds something to do however.
There is a lot of optimisation possible that would be too expensive in an
interpreter, but whether this just sorts out badly written code or whether it
improves on the internal workings of any possible interpreter is moot.

IMO it would be worth being able to restrict the language (by an OPTIONS
statement) so that compiling can be worthwhile. Then instead of writing a
subroutine in C because it just has to be fast, you write it in restricted Rexx
so that it can be interpreted along with everything else for speed of
development. All the code would be compiled: the non-restricted modules would
be to optimised intermediate code with a linked specialised interpreter, the
restricted modules would be to machine-code with an interface to the linked
interpreter. Use of INTERPRET would require a parser to be dynamically linked.
Not sure whether the needed restrictions would cripple the language though. Any
opinions?

Yours, Patrick
_____________________________________________________________________________


I tend to eat my UUCP feed once a day so replies can take two days



Mon, 20 Oct 1997 03:00:00 GMT  
 Why is Rexx hard to compile.

: >What exactly is so difficult about compiling REXX.
: >
: >djs.
: >

If this is just a 'philosophical question', I guess that the main problem
is related to the interpret instruction : I can't immagine how you can
compile an instruction that is not defined at compile time.
BTW it is always possible to rely then on the interpreter to do the job,
under VM the interpreter is always available but what if the user has not
installed the Rexx support under OS/2?

just my to 0.02 FF (1 USD = 5FF immagine the real value...)

Jean-Pierre Cabani/e



Tue, 21 Oct 1997 03:00:00 GMT  
 Why is Rexx hard to compile.
On Fri, 5 May 1995 11:40:28 -0400 Ian S Nelson said:
... stuff deleted ...

Quote:

>> 3) The INTERPRET instruction can force the execution of arbitrary code.

>This is also done all the time with assembly language. (take polymorphic
>viruses for a real world example)
>I want to say this can be done with objective-c, but I can't think of a
>good example or way to do it off hand.  This is a feature that your
>better interpreted languages support though... Could anyone provide me a
>good example of this function being used in rexx that would be difficult
>to translate?

    Well folks here is a good example of a function difficult to be translated,
 this program search for a nickname in a names file and assign variables for
 all tags in that file without know the tag-names... I tried to do this without
 the INTERPRET, but I think this is impossible...

/* */; trace o
DropBuf
Parse Arg Nick FName .
'NameF :Nick' Nick '(File' FName 'Type * Stack'
TagList = ''
Do Queued()
 Parse Pull ':'Tag Context
 Upper Tag Nick
 If WordPos(Tag, TagList) = 0 Then TagList = TagList Tag
 Interpret Tag'.'Nick' = "'Context'"'
End

do i = 1  to Words(TagList)
  Tag = Word(TagList,i)
  Interpret 'StrOut = 'Tag'.'Nick
  say 'Tag:' Tag '=' StrOut
end
Exit 0

    Ohh yes, this example is for a IBM/CMS REXX interpreter, the IBM-REXX
 compiler don't compile INTERPRET instructions :)

                                             Antonio.

Quote:

>Carnegie Mellon Computer Science/Math
>Home Page:http://www.contrib.andrew.cmu.edu/usr/in22/ian.html
>My opinions are not the school's, although they should be!

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Antonio S. Martins Jr. - System Analyst | Office: +55 (44) 226-2727 r. 224  |
| State University of Maringa - Brasil    |         +55 (44) 223-4537         |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        "Only The Shadow Knows what evil lurks in the Heart of Men!"


Tue, 21 Oct 1997 03:00:00 GMT  
 Why is Rexx hard to compile.
Excerpts from netnews.comp.lang.rexx: 2-May-95 Re: Why is Rexx hard to

Quote:

> >>What exactly is so difficult about compiling REXX.

> I can think of three reasons REXX is difficult to compile:

> 1) The math is precisely defined and does not match any existing chipset.
> Thus all math will be done by library.

come again?  How does this affect compilation?

Quote:
> 2) The set of known variables is not known at compile time, so space for
> variables cannot be preallocated, thus references must be "interpreted".

This is done all the time with compiled code.  Without dynamic memory
allocation most languages would be near useless.

Quote:
> 3) The INTERPRET instruction can force the execution of arbitrary code.

This is also done all the time with assembly language. (take polymorphic
viruses for a real world example)
I want to say this can be done with objective-c, but I can't think of a
good example or way to do it off hand.  This is a feature that your
better interpreted languages support though... Could anyone provide me a
good example of this function being used in rexx that would be difficult
to translate?  

Quote:
> Sorry this is so puny, but many REXXperts are at SLAC today for the
> symposium.   Dave

--

Carnegie Mellon Computer Science/Math    
Home Page:http://www.contrib.andrew.cmu.edu/usr/in22/ian.html
My opinions are not the school's, although they should be!


Tue, 21 Oct 1997 03:00:00 GMT  
 Why is Rexx hard to compile.
On Fri, 5 May 1995 11:40:28 -0400 Ian S Nelson said:

Quote:
>Excerpts from netnews.comp.lang.rexx: 2-May-95 Re: Why is Rexx hard to

>> ...
>> 2) The set of known variables is not known at compile time, so space for
>> variables cannot be preallocated, thus references must be "interpreted".

>This is done all the time with compiled code.  Without dynamic memory
>allocation most languages would be near useless.

This is not (usually) the same thing.  In most cases the size and offset
of variables from the DSA is known at compile time and all that has to be
supplied at run time is the address of the storage area - a snap with most
machine instruction sets.  Some languages (PL/I and GNU C come to mind)
allow the size of a dynamic array to be determined at run time on entry
to a block, but this is a special case.  PL/I VARYING character strings
have storage for the max size pre-allocated.  Rexx allows *all* variables
to vary in size from 'empty' to 'huge'.  In addition the list of variables
'known' at compile time on entry to a block can be determined for C
(global variables) and PL/I (EXTERNAL variables plus whatever is declared
in the blocks that contain the current block).  With REXX the variables
'known' are those that have been referenced *at execution time* before
executing a piece of code.  Also, tails of compound variables can be
dynamically defined - there is no way of determining beforehand how many
or what they may be.  In short, every variable reference in REXX will
involve a symbol-table lookup at execution time.

Quote:

>> 3) The INTERPRET instruction can force the execution of arbitrary code.

>This is also done all the time with assembly language. (take polymorphic
>viruses for a real world example)
>...

This again is a different thing.  Sure assembly instructions can be
constructed or modified at run time, but they are executed exactly the
same as compiled instructions.  REXX's INTERPRET function forces the
interpreter to be available during execution - as if an assembler
programmer could only build symbolic instructions and then had to call
the assembler to generate machine code before they could be executed -
each time INTERPRET is encountered.

--------

Systems Programmer -- Team OS/2
NYS Legislative Bill Drafting Commission
1450 Western Avenue, 3rd floor
Albany, NY 12203
Voice:(518)458-5114  FAX:(518)458-5108

"ALWAYS SPELL-CHECK ALL YOUR DOUCMNETS"



Tue, 21 Oct 1997 03:00:00 GMT  
 Why is Rexx hard to compile.

Quote:

>>What exactly is so difficult about compiling REXX.
..
>IMO it would be worth being able to restrict the language (by an OPTIONS
>statement) so that compiling can be worthwhile. Then instead of writing a
>subroutine in C because it just has to be fast, you write it in restricted Rexx
>so that it can be interpreted along with everything else for speed of
>development.

My experience is that compiled REXX programs execute on VM 10 - 300 faster
(no INTERPRET used). It is definitely worthwhile to compile.

Quote:
>... Use of INTERPRET would require a parser to be dynamically linked.

The IBM compiler uses the interpreter's modules for INTERPRET per-runtime,
I think.

The are two other points about compiling, which weren't mentioned yet:

- by compiling you prevent the user from being able to MODIFY production
  code. I appreciate the power of the interpreted language during the
  development but I would never allow the user to be able to change the
  real stuff.

- by compiling you protect your intelectual property.

I think, those were the reasons IBM Vienna created an excellent REXX
compiler for VM and MVS. At some point they were soliciting opinions
about an OS/2 version. I haven't hear from them for a long time but
since we got PL/I on OS/2 everything is possible...

Gregory Czaja                            ---> DeskMan/2 utilities



Wed, 22 Oct 1997 03:00:00 GMT  
 Why is Rexx hard to compile.

: On Fri, 5 May 1995 11:40:28 -0400 Ian S Nelson said:

:     Well folks here is a good example of a function difficult to be translated,
:  this program search for a nickname in a names file and assign variables for
:  all tags in that file without know the tag-names... I tried to do this without
:  the INTERPRET, but I think this is impossible...

    [ ... ]
:  Interpret Tag'.'Nick' = "'Context'"'
    [ ... ]
:   Interpret 'StrOut = 'Tag'.'Nick
    [ ... ]

How about:

    [ ... ]
   Table.Tag.Nick = Context
    [ ... ]
   StrOut = Table.Tag.Nick
    [ ... ]

in place of your interpreted lines?  By the way, this avoids three apparent
bugs in your code, viz:

1) If the value of either "Tag" or "Nick" is not a valid Rexx variable
   name a syntax error may occur.

2) If the value of the variable "Nick" is itself the name of a defined
   variable, the program may give incorrect results.

3) If the variable "Context" contains an internal quotation mark, Interpret
   gets a syntax error.

-- gil



Thu, 23 Oct 1997 03:00:00 GMT  
 
 [ 27 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Why is COMPILE-FILE better than COMPILE?

2. Why so hard to get started in Eiffel?

3. REXX r.e.s (was Re: Why do I like REXX)

4. Why are Variables so hard to monitor?

5. Why JPython for the hard stuff?

6. why is tree-shaking hard?

7. hard coding compile time into a program

8. why why why oh why why baby

9. Hard disk problems - Hard ones :))

10. Hard disk I/O the hard way

11. Why am I getting bind errors?

12. Help with a view PLEASE I am using CW2003 and compiling in 32bit

 

 
Powered by phpBB® Forum Software