[24600] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 6776 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 7 18:10:55 2004

Date: Wed, 7 Jul 2004 15:10:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 7 Jul 2004     Volume: 10 Number: 6776

Today's topics:
    Re: Why use dollar sign $ for variables <postmaster@castleamber.com>
    Re: Why use dollar sign $ for variables <postmaster@castleamber.com>
    Re: Why use dollar sign $ for variables <postmaster@castleamber.com>
    Re: Why use dollar sign $ for variables <vticau@excite.com>
    Re: Why use dollar sign $ for variables <cwilbur@mithril.chromatico.net>
        Writing a Lisp interpreter in Perl? (Asmo)
    Re: Writing a Lisp interpreter in Perl? <pinyaj@rpi.edu>
    Re: Writing a Lisp interpreter in Perl? <mikee@mikee.ath.cx>
    Re: Writing a Lisp interpreter in Perl? sap6210@rit.edu
    Re: Writing a Lisp interpreter in Perl? <pinyaj@rpi.edu>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 07 Jul 2004 10:36:27 -0500
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Why use dollar sign $ for variables
Message-Id: <40ec187f$0$876$58c7af7e@news.kabelfoon.nl>

Dave Cross wrote:

> On Tue, 06 Jul 2004 20:14:22 -0700, Ramon F Herrera wrote:
> 
>>Let's not forget an important difference between C and Perl.
>>One is compiled, and compilation can take as long as necessary.
>>Being interpreted, Perl has to parse souce code and catch errors
>>on the fly at the same time as it executes valid code, as fast
>>as possible.
> 
> Perl isn't interpreted, it's compiled. Sure it's compiled each time you
> run your program, but it's still compiled. Not interpreted.

Of course it's interpreted :-D

-- 
John                               MexIT: http://johnbokma.com/mexit/
                            personal page:       http://johnbokma.com/
    Experienced Perl programmer available:     http://castleamber.com/
             Happy Customers: http://castleamber.com/testimonials.html


------------------------------

Date: Wed, 07 Jul 2004 10:38:48 -0500
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Why use dollar sign $ for variables
Message-Id: <40ec190c$0$876$58c7af7e@news.kabelfoon.nl>

Joe Smith wrote:

> Ramon F Herrera wrote:
> 
>> Let's not forget an important difference between C and Perl.
>> One is compiled, and compilation can take as long as necessary.
>> Being interpreted, Perl has to parse souce code and catch errors
>> on the fly at the same time as it executes valid code, as fast
>> as possible.
> 
> Unlike /bin/sh, bash, tcsh, etc, perl does not interpret (parse and
> execute) the script a line at a time as you implied.
> 
> In the absence of any 'use' statements or BEGIN{} blocks, perl parses
> the entire program before executing any code.  It does this every time
> the perl script is invoked, vaguely like an interpreter, but perl
> definitely has a compile phase and a run phase.

Even interpreted BBC Basic (IIRC) had that. Constant folding and some 
other optimizations IIRC, but I still call it an interpreter :-D.

-- 
John                               MexIT: http://johnbokma.com/mexit/
                            personal page:       http://johnbokma.com/
    Experienced Perl programmer available:     http://castleamber.com/
             Happy Customers: http://castleamber.com/testimonials.html


------------------------------

Date: Wed, 07 Jul 2004 10:39:20 -0500
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Why use dollar sign $ for variables
Message-Id: <40ec192c$0$876$58c7af7e@news.kabelfoon.nl>

Rene Nyffenegger wrote:

>>Unlike /bin/sh, bash, tcsh, etc, perl does not interpret (parse and
>>execute) the script a line at a time as you implied.
>>
>>In the absence of any 'use' statements or BEGIN{} blocks, perl parses
>>the entire program before executing any code.  It does this every time
>>the perl script is invoked, vaguely like an interpreter, but perl
>>definitely has a compile phase and a run phase.
>>	-Joe
> 
> Just out of curiosity: would it be possible to store the compiled/parsed 
> script away and load it later so that a script doesn't have to be
> compiled again if it hasn't changed?

IIRC; yes, have a look at the B modules.

-- 
John                               MexIT: http://johnbokma.com/mexit/
                            personal page:       http://johnbokma.com/
    Experienced Perl programmer available:     http://castleamber.com/
             Happy Customers: http://castleamber.com/testimonials.html


------------------------------

Date: Wed, 07 Jul 2004 16:47:02 GMT
From: vali <vticau@excite.com>
Subject: Re: Why use dollar sign $ for variables
Message-Id: <aOVGc.5441$YR1.2304@news.cpqcorp.net>

Dale Henderson wrote:

>>>>>>"DHA" == David H Adler <dha@panix.com> writes:
>>>>>>            
>>>>>>
>
>    DHA> Not to mention that you can have these sets of variables:
>
>    DHA> $chomp, @chomp, %chomp
>    DHA> $print, @print, %print
>    DHA> $foreach @foreach %foreach
>
>    DHA> Although that is probably rarely a good idea. :-)
>
>    DHA> dha
>
>     I often use constructs like 
>
>     foreach $color (@color){...}
>
>     
>     
>
>  
>
or maybe even better:
foreach $color (@colors){...}
                      ^
__Vali



------------------------------

Date: Wed, 07 Jul 2004 20:12:33 GMT
From: Charlton Wilbur <cwilbur@mithril.chromatico.net>
Subject: Re: Why use dollar sign $ for variables
Message-Id: <878ydva8e0.fsf@mithril.chromatico.net>

>>>>> "MD" == Michele Dondi <bik.mido@tiscalinet.it> writes:

    MD> I have had some exposure to various programming languages, but
    MD> for for a series of reasons now I'm routinely using only
    MD> Perl. Well, when I happen to stumble onto snippets of code
    MD> from other languages, including very "common" ones like C/C++
    MD> or Java, my instinctive reaction is "Hey, where are $'s, @'s
    MD> and %'s?!?"

    MD> Also, they mark very clearly the different syntactic/semantic
    MD> behaviour of different kinds variables in agreement with the
    MD> natural languages principles that are so pervasive in Perl,
    MD> just like different suffixes help to tell e.g. verbs from
    MD> nouns in many actual natural languages.

I think part of this has to do with the expressiveness of Perl as
well.  I'm using Perl, C, and Objective-C fairly equally nowadays, and
it seems to me that C and Objective-C have far fewer constructs and
far fewer keywords -- and as a result, it's much easier to spot the
variables.  By contrast, Perl, which has a far wider variety of legal
constructs, a far wider variety of reserved words, and a lot of
flexibility within those constructs and with those words, uses sigils
to set off variables because it makes things easier for humans to
understand.

Or, stated another way, most of the power of Objective-C is in the
libraries, and the language is pretty much just the glue that holds
the library calls together.  Much of the power of Perl is in the core
language.  Because of this, any tool such as sigils on variables that
makes Perl code easier for humans to parse and understand --
regardless of the ease with which computers may parse and understand
it -- is useful.

Charlton


-- 
cwilbur at chromatico dot net
cwilbur at mac dot com


------------------------------

Date: 7 Jul 2004 10:52:12 -0700
From: sap6210@rit.edu (Asmo)
Subject: Writing a Lisp interpreter in Perl?
Message-Id: <cf6bc6e2.0407070952.7f015813@posting.google.com>

Hi all.  I was thinking of doing a personal project, and I was
considering which, out of my favorite two languages (Perl and Lisp) I
should do it in, when I decided I could combine both into one awesome
project!

I want to write a Lisp interpreter in Perl, but I was wondering a few
things before undertaking such a task:

1) Has it been done before? I did a search through CPAN, and found a
few implementations of some Lisp things, but not a complete
interpretor, and a search on google returned a few things as well, but
nothing complete.  So has anyone heard of this being done?

2) Is it impossible?  I can understand (and indeed, I look forward to)
a challenge, but if there is some reason it will be impossible, I'd
like to know before putting time into it.

3) Does anyone have any advice?  Luckily for me, most of the ANSI Lisp
functions can be written using other Lisp code, so if I can provide
basic functionality, I could be pretty well set.  But if anyone has
any words of wisdom, I'd be glad to hear.

Alright, thanks guys, and sorry if I'm wasting your time!


------------------------------

Date: Wed, 7 Jul 2004 14:43:39 -0400
From: Jeff 'japhy' Pinyan <pinyaj@rpi.edu>
To: Asmo <sap6210@rit.edu>
Subject: Re: Writing a Lisp interpreter in Perl?
Message-Id: <Pine.SGI.3.96.1040707144040.34865A-100000@vcmr-64.server.rpi.edu>

[posted & mailed]

On 7 Jul 2004, Asmo wrote:

>1) Has it been done before? I did a search through CPAN, and found a
>few implementations of some Lisp things, but not a complete
>interpretor, and a search on google returned a few things as well, but
>nothing complete.  So has anyone heard of this being done?

Gisle Aas (of LWP fame) has written something:

  http://search.cpan.org/~gaas/perl-lisp-0.05/

--
Jeff "japhy" Pinyan         %  How can we ever be the sold short or
RPI Acacia Brother #734     %  the cheated, we who for every service
RPI Corporation Secretary   %  have long ago been overpaid?
http://japhy.perlmonk.org/  %  
http://www.perlmonks.org/   %    -- Meister Eckhart




------------------------------

Date: Wed, 07 Jul 2004 18:42:23 -0000
From: Mike <mikee@mikee.ath.cx>
Subject: Re: Writing a Lisp interpreter in Perl?
Message-Id: <10eoh0fl6aonu75@corp.supernews.com>

In article <cf6bc6e2.0407070952.7f015813@posting.google.com>, Asmo wrote:
> Hi all.  I was thinking of doing a personal project, and I was
> considering which, out of my favorite two languages (Perl and Lisp) I
> should do it in, when I decided I could combine both into one awesome
> project!
> 
> I want to write a Lisp interpreter in Perl, but I was wondering a few
> things before undertaking such a task:
> 
> 1) Has it been done before? I did a search through CPAN, and found a
> few implementations of some Lisp things, but not a complete
> interpretor, and a search on google returned a few things as well, but
> nothing complete.  So has anyone heard of this being done?
> 
> 2) Is it impossible?  I can understand (and indeed, I look forward to)
> a challenge, but if there is some reason it will be impossible, I'd
> like to know before putting time into it.
> 
> 3) Does anyone have any advice?  Luckily for me, most of the ANSI Lisp
> functions can be written using other Lisp code, so if I can provide
> basic functionality, I could be pretty well set.  But if anyone has
> any words of wisdom, I'd be glad to hear.
> 
> Alright, thanks guys, and sorry if I'm wasting your time!

Write a function that examines a string (scalar) one character
at a time that can then build a dynamic array that has the atoms
and references to other arrays and other atoms? Once you break the
string apart then you have the read-eval loop function that is recursive.
This function takes a hash as part of the input, or use a global hash.
This hash is your variable environment. Your lisp eval() function
updates, sets, and deletes values from this hash.

What do you think?

Mike


------------------------------

Date: 7 Jul 2004 13:20:14 -0700
From: sap6210@rit.edu
Subject: Re: Writing a Lisp interpreter in Perl?
Message-Id: <cchltu$8hh@odak26.prod.google.com>

Actually Mike, that was pretty close to what I was planning on doing.
I figured it would work out pretty well:)

However, Jeff already posted a link to a Lisp interpretor someone else
did.  :(  So that's kind of depressing, because I thought I was pretty
original.

Ah well.  Maybe I'll do one anyway.  Or maybe I'll think up another
project.  We'll see.

Steve


Mike wrote:
> In article <cf6bc6e2.0407070952.7f015813@posting.google.com>, Asmo
wrote:
> > Hi all.  I was thinking of doing a personal project, and I was
> > considering which, out of my favorite two languages (Perl and Lisp)
I
> > should do it in, when I decided I could combine both into one
awesome
> > project!
> >
> > I want to write a Lisp interpreter in Perl, but I was wondering a
few
> > things before undertaking such a task:
> >
> > 1) Has it been done before? I did a search through CPAN, and found
a
> > few implementations of some Lisp things, but not a complete
> > interpretor, and a search on google returned a few things as well,
but
> > nothing complete.  So has anyone heard of this being done?
> >
> > 2) Is it impossible?  I can understand (and indeed, I look forward
to)
> > a challenge, but if there is some reason it will be impossible, I'd
> > like to know before putting time into it.
> >
> > 3) Does anyone have any advice?  Luckily for me, most of the ANSI
Lisp
> > functions can be written using other Lisp code, so if I can provide
> > basic functionality, I could be pretty well set.  But if anyone has
> > any words of wisdom, I'd be glad to hear.
> >
> > Alright, thanks guys, and sorry if I'm wasting your time!
>
> Write a function that examines a string (scalar) one character
> at a time that can then build a dynamic array that has the atoms
> and references to other arrays and other atoms? Once you break the
> string apart then you have the read-eval loop function that is
recursive.
> This function takes a hash as part of the input, or use a global
hash.
> This hash is your variable environment. Your lisp eval() function
> updates, sets, and deletes values from this hash.
> 
> What do you think?
> 
> Mike



------------------------------

Date: Wed, 7 Jul 2004 16:33:45 -0400
From: Jeff 'japhy' Pinyan <pinyaj@rpi.edu>
Subject: Re: Writing a Lisp interpreter in Perl?
Message-Id: <Pine.SGI.3.96.1040707163153.36335A-100000@vcmr-64.server.rpi.edu>

On 7 Jul 2004 sap6210@rit.edu wrote:

>However, Jeff already posted a link to a Lisp interpretor someone else
>did.  :(  So that's kind of depressing, because I thought I was pretty
>original.
>
>Ah well.  Maybe I'll do one anyway.  Or maybe I'll think up another
>project.  We'll see.

You needn't give up hope.  For one, you could see if Gisle's
implementation has any faults, and correct them and submit them.  A good
way to find inadequecies is to search for 'XXX' in the source.  That's
usually a sign the programmer is saying "this isn't 100% correct, because
 ...".

Or you could write a parser for another favorite language. ;)

--
Jeff "japhy" Pinyan         %  How can we ever be the sold short or
RPI Acacia Brother #734     %  the cheated, we who for every service
RPI Corporation Secretary   %  have long ago been overpaid?
http://japhy.perlmonk.org/  %  
http://www.perlmonks.org/   %    -- Meister Eckhart




------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 6776
***************************************


home help back first fref pref prev next nref lref last post