Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Some PIR "How do I?" questions
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  21 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dan Sugalski  
View profile  
 More options Nov 21 2003, 3:48 pm
Newsgroups: perl.perl6.internals
From: d...@sidhe.org (Dan Sugalski)
Date: Fri, 21 Nov 2003 15:18:29 -0500 (EST)
Local: Fri, Nov 21 2003 3:18 pm
Subject: Some PIR "How do I?" questions
These could use some documenting (and yes, I know the answer to many) for
future use for folks generating PIR. (Hint, hint -- documentation is a
good thing)

*) How do I declare an externally visible subroutine?

*) How do I store a global variable

*) How do I load a global variable

*) How do I call an external function

*) How do I get the sub pmc for a sub declared later (or earlier) in the
file?

*) How do I (or even can I) have a file-scoped variable? (like .local,
only for all code in the file)

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
d...@sidhe.org                         have teddy bears and even
                                      teddy bears get drunk


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sterling Hughes  
View profile  
 More options Nov 22 2003, 7:48 am
Newsgroups: perl.perl6.internals
From: win...@edwardbear.org (Sterling Hughes)
Date: Sat, 22 Nov 2003 04:36:29 -0800
Local: Sat, Nov 22 2003 7:36 am
Subject: Re: Some PIR "How do I?" questions

*) How do I do the following in PIR:

package Foo::Bar;

my $joe = 42;

sub new {
        bless {};

}

sub prnJoe {
        my $self = shift;
        print $self->jo;

}

package main;

$f = Foo::Bar->new();
$f->prnJoe();

Would also be *really* great (I'm trying to implement the IMC codegen in
PHP for classes and objects right now :)

-Sterling


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Melvin Smith  
View profile  
 More options Nov 22 2003, 1:48 pm
Newsgroups: perl.perl6.internals
From: mrjoltc...@mindspring.com (Melvin Smith)
Date: Sat, 22 Nov 2003 13:02:53 -0500
Local: Sat, Nov 22 2003 1:02 pm
Subject: Re: Some PIR "How do I?" questions
At 03:18 PM 11/21/2003 -0500, Dan Sugalski wrote:

>These could use some documenting (and yes, I know the answer to many) for
>future use for folks generating PIR. (Hint, hint -- documentation is a
>good thing)

I will make an attempt at answering all of these regarding how it is today,
as opposed to how it should/will be very soon; --- later tonight, that is,
when I get back from playing golf =:)

I'm also starting on real IMCC documentation.

-Melvin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gregor N. Purdy  
View profile  
 More options Nov 23 2003, 12:48 pm
Newsgroups: perl.perl6.internals
From: gre...@focusresearch.com (Gregor N. Purdy)
Date: Sun, 23 Nov 2003 08:57:36 -0800
Local: Sun, Nov 23 2003 11:57 am
Subject: Re: Some PIR "How do I?" questions
Umm.. Do you mean:

------------------------------------------------------------
package Foo::Bar;

sub new {
  my $class = shift;
  return bless { jo => 42 }, $class;

}

sub prnJoe {
  my $self = shift;
  print $self->{jo}, "\n";

}

package main;

$f = Foo::Bar->new();
$f->prnJoe();
------------------------------------------------------------

Regards,

-- Gregor

--
Gregor Purdy                            gre...@focusresearch.com
Focus Research, Inc.               http://www.focusresearch.com/

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Melvin Smith  
View profile  
 More options Nov 24 2003, 2:48 am
Newsgroups: perl.perl6.internals
From: mrjoltc...@mindspring.com (Melvin Smith)
Date: Mon, 24 Nov 2003 02:06:31 -0500
Local: Mon, Nov 24 2003 2:06 am
Subject: Re: Some PIR "How do I?" questions
At 03:18 PM 11/21/2003 -0500, Dan Sugalski wrote:

I just checked in an intial IMCC faq (parrot/imcc/docs/imcfaq.pod)

Hopefully we'll get it linked up in HTML format to the web site asap.

The FAQ is small, but it at least answers all of the above.

I did not go in too much depth about subs because I've got a wave
of changes to commit soon, so I want to hold off on documenting
syntax that is about to be deprecated.

Feel free to send me more questions for the FAQ.

-Melvin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jerome Quelin  
View profile  
 More options Nov 24 2003, 1:00 pm
Newsgroups: perl.perl6.internals
From: jque...@mongueurs.net (Jerome Quelin)
Date: Mon, 24 Nov 2003 18:48:16 +0100
Local: Mon, Nov 24 2003 12:48 pm
Subject: Re: Some PIR "How do I?" questions

Melvin Smith wrote:
> I just checked in an intial IMCC faq (parrot/imcc/docs/imcfaq.pod)

Great job. Attached you'll find some corrections for typos.

> The FAQ is small, but it at least answers all of the above.

As I see it, the faq will grow fast... Maybe we'll have to split it in
different parts (generalities, subs / calling conventions, variable
declaration / access, etc.). But maybe later.

> Feel free to send me more questions for the FAQ.

Ok, here are some more (some questions are easy - but a faq should also
have some easy items -, others are not yet possible, but anyway):

* How does one retrieve arguments given on the command-line?
* How does one call a function? With arguments? With a variable number
of arguments? Get the return value(s) of a sub?
* How does one read from a file? stdin? unbuffered stdin?
* How does one create socket and network stuff?
* How does one launch an exception? trap an exception?
* How does one create a class? instanciate an object?

Jerome
--
jque...@mongueurs.net


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jerome Quelin  
View profile  
 More options Nov 24 2003, 1:00 pm
Newsgroups: perl.perl6.internals
From: jque...@mongueurs.net (Jerome Quelin)
Date: Mon, 24 Nov 2003 18:49:18 +0100
Local: Mon, Nov 24 2003 12:49 pm
Subject: Re: Some PIR "How do I?" questions

Jerome Quelin wrote:
> Melvin Smith wrote:
> > I just checked in an intial IMCC faq (parrot/imcc/docs/imcfaq.pod)
> Great job. Attached you'll find some corrections for typos.

And of course I forgot the patch file. Here it is.

Jerome
--
jque...@mongueurs.net

  imcfaq_typos.patch
1K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Melvin Smith  
View profile  
 More options Nov 24 2003, 1:48 pm
Newsgroups: perl.perl6.internals
From: mrjoltc...@mindspring.com (Melvin Smith)
Date: Mon, 24 Nov 2003 12:58:54 -0500
Local: Mon, Nov 24 2003 12:58 pm
Subject: Re: Some PIR "How do I?" questions
At 06:48 PM 11/24/2003 +0100, Jerome Quelin wrote:

>Melvin Smith wrote:
> > I just checked in an intial IMCC faq (parrot/imcc/docs/imcfaq.pod)

>Great job. Attached you'll find some corrections for typos.

Thanks. BTW Robert has linked the HTML FAQ to the site.
You can get to it from the Resources tab, or just go straight
to http://www.parrotcode.org/faq/imcc

I much prefer reading it in a browser.

> > Feel free to send me more questions for the FAQ.

>Ok, here are some more (some questions are easy - but a faq should also
>have some easy items -, others are not yet possible, but anyway):

>* How does one retrieve arguments given on the command-line?
>* How does one call a function? With arguments? With a variable number
>of arguments? Get the return value(s) of a sub?
>* How does one read from a file? stdin? unbuffered stdin?
>* How does one create socket and network stuff?
>* How does one launch an exception? trap an exception?
>* How does one create a class? instanciate an object?

I'll get to work on these. Look for something tonight or tomorrow.
Some of this refreshes my memory on things I need to implement.

-Melvin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dan Sugalski  
View profile  
 More options Nov 24 2003, 1:48 pm
Newsgroups: perl.perl6.internals
From: d...@sidhe.org (Dan Sugalski)
Date: Mon, 24 Nov 2003 13:11:03 -0500 (EST)
Local: Mon, Nov 24 2003 1:11 pm
Subject: Re: Some PIR "How do I?" questions

On Mon, 24 Nov 2003, Jerome Quelin wrote:
> Ok, here are some more (some questions are easy - but a faq should also
> have some easy items -, others are not yet possible, but anyway):

> * How does one retrieve arguments given on the command-line?
> * How does one call a function? With arguments? With a variable number
> of arguments? Get the return value(s) of a sub?
> * How does one read from a file? stdin? unbuffered stdin?
> * How does one create socket and network stuff?
> * How does one launch an exception? trap an exception?
> * How does one create a class? instanciate an object?

With the exception of the second bullet item, these are generic parrot
FAQs rather than IMCC/PIR specific ones, so ought to be put in a different
FAQ or doc section...

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
d...@sidhe.org                         have teddy bears and even
                                      teddy bears get drunk


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jerome Quelin  
View profile  
 More options Nov 24 2003, 1:48 pm
Newsgroups: perl.perl6.internals
From: jque...@mongueurs.net (Jerome Quelin)
Date: Mon, 24 Nov 2003 19:18:33 +0100
Local: Mon, Nov 24 2003 1:18 pm
Subject: Re: Some PIR "How do I?" questions

Dan Sugalski wrote:
> On Mon, 24 Nov 2003, Jerome Quelin wrote:
> > * How does one retrieve arguments given on the command-line?
> > * How does one call a function? With arguments? With a variable
> > number of arguments? Get the return value(s) of a sub?
> > * How does one read from a file? stdin? unbuffered stdin?
> > * How does one create socket and network stuff?
> > * How does one launch an exception? trap an exception?
> > * How does one create a class? instanciate an object?

> With the exception of the second bullet item, these are generic
> parrot FAQs rather than IMCC/PIR specific ones, so ought to be put in
> a different FAQ or doc section...

Correct, but then someone new to parrot who wants to write a compiler
targetting parrot will need to look for and read faqs in a lot of
different places...

I think the real question is: do we want to promote imcc as _the_ target
language for compilers targetting parrot?
If the answer is yes (as I thought it was), then I don't think we need a
pasm faq...

Jerome
--
jque...@mongueurs.net


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Melvin Smith  
View profile  
 More options Nov 24 2003, 11:48 pm
Newsgroups: perl.perl6.internals
From: mrjoltc...@mindspring.com (Melvin Smith)
Date: Mon, 24 Nov 2003 23:22:02 -0500
Local: Mon, Nov 24 2003 11:22 pm
Subject: Re: Some PIR "How do I?" questions
At 07:18 PM 11/24/2003 +0100, Jerome Quelin wrote:

>Dan Sugalski wrote:
> > On Mon, 24 Nov 2003, Jerome Quelin wrote:
> > > * How does one launch an exception? trap an exception?
> > > * How does one create a class? instanciate an object?

> > With the exception of the second bullet item, these are generic
> > parrot FAQs rather than IMCC/PIR specific ones, so ought to be put in
> > a different FAQ or doc section...

The last 2 bullet items will also be specific to IMCC. The syntax for defining
a class will trigger IMCC to construct and freeze the class with the bytecode
at compile time which means it wont generate any Parrot instructions.
That is how it currently does constant subs. Also, exceptions in IMCC
will certainly be a briefer syntax, maybe even try/catch.

>I think the real question is: do we want to promote imcc as _the_ target
>language for compilers targetting parrot?

The answer is yes.

>If the answer is yes (as I thought it was), then I don't think we need a
>pasm faq...

We still need one but I do not want to maintain it, myself.
Simon Cozens already wrote some stuff that could be used as a
start. Of course there is also Perl6 Essentials. :)

We DO need a Parrot Programming FAQ. I propose the IMCC faq functions
as just that. We can still have the current Parrot FAQ, which is
great at answering generic questions for people who haven't swallowed
the blue pill yet. (Or was it the red pill, I vaguely remember Dan in a black
trenchcoat and glasses, and guns.....)

-Melvin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Melvin Smith  
View profile  
 More options Nov 24 2003, 11:48 pm
Newsgroups: perl.perl6.internals
From: mrjoltc...@mindspring.com (Melvin Smith)
Date: Mon, 24 Nov 2003 23:03:17 -0500
Local: Mon, Nov 24 2003 11:03 pm
Subject: Re: Some PIR "How do I?" questions
At 06:49 PM 11/24/2003 +0100, Jerome Quelin wrote:

>Jerome Quelin wrote:
> > Melvin Smith wrote:
> > > I just checked in an intial IMCC faq (parrot/imcc/docs/imcfaq.pod)
> > Great job. Attached you'll find some corrections for typos.

>And of course I forgot the patch file. Here it is.

Thanks, applied!

Also I added another sample that might interest compiler writers
that may be new to Parrot/IMCC syntax. It just shows one approach
to compiling a class with fields, methods and instantiating them.

The syntax is a workaround for the lack of explicit class/object support
in Parrot.

-Melvin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dan Sugalski  
View profile  
 More options Nov 25 2003, 9:48 am
Newsgroups: perl.perl6.internals
From: d...@sidhe.org (Dan Sugalski)
Date: Tue, 25 Nov 2003 09:01:11 -0500 (EST)
Local: Tues, Nov 25 2003 9:01 am
Subject: Re: Some PIR "How do I?" questions

On Mon, 24 Nov 2003, Melvin Smith wrote:
> We DO need a Parrot Programming FAQ. I propose the IMCC faq functions
> as just that. We can still have the current Parrot FAQ, which is
> great at answering generic questions for people who haven't swallowed
> the blue pill yet. (Or was it the red pill, I vaguely remember Dan in a black
> trenchcoat and glasses, and guns.....)

I think separating the IMCC and parrot programming FAQs, or making the
IMCC faq a section of a larger Parrot FAQ, would be better. The IMCC FAQ
really ought to be about syntax rather than semantics.

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
d...@sidhe.org                         have teddy bears and even
                                      teddy bears get drunk


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert Spier  
View profile  
 More options Nov 26 2003, 1:48 am
Newsgroups: perl.perl6.internals
From: rsp...@pobox.com (Robert Spier)
Date: Tue, 25 Nov 2003 21:50:20 -0800
Local: Wed, Nov 26 2003 12:50 am
Subject: Re: Some PIR "How do I?" questions

> I think separating the IMCC and parrot programming FAQs, or making the
> IMCC faq a section of a larger Parrot FAQ, would be better. The IMCC FAQ
> really ought to be about syntax rather than semantics.

Patches welcome.

:-J

-R


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pete Lomax  
View profile  
 More options Nov 27 2003, 7:48 am
Newsgroups: perl.perl6.internals
From: petelo...@blueyonder.co.uk (Pete Lomax)
Date: Thu, 27 Nov 2003 12:02:42 +0000
Local: Thurs, Nov 27 2003 7:02 am
Subject: Re: Some PIR "How do I?" questions
Perl6 already does interpolation without special support from IMCC.

That's nice for it. Where do I go crib from?

Pete


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Melvin Smith  
View profile  
 More options Nov 27 2003, 10:48 am
Newsgroups: perl.perl6.internals
From: mrjoltc...@mindspring.com (Melvin Smith)
Date: Thu, 27 Nov 2003 09:52:10 -0500
Local: Thurs, Nov 27 2003 9:52 am
Subject: Re: Some PIR "How do I?" questions
At 12:02 PM 11/27/2003 +0000, Pete Lomax wrote:

>Perl6 already does interpolation without special support from IMCC.

>That's nice for it. Where do I go crib from?

?

-Melvin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pete Lomax  
View profile  
 More options Nov 27 2003, 12:48 pm
Newsgroups: perl.perl6.internals
From: petelo...@blueyonder.co.uk (Pete Lomax)
Date: Thu, 27 Nov 2003 17:38:47 +0000
Local: Thurs, Nov 27 2003 12:38 pm
Subject: Re: Some PIR "How do I?" questions
On Thu, 27 Nov 2003 09:52:10 -0500, Melvin Smith

<mrjoltc...@mindspring.com> wrote:
>At 12:02 PM 11/27/2003 +0000, Pete Lomax wrote:
>>Perl6 already does interpolation without special support from IMCC.

>>That's nice for it. Where do I go crib from?

>?

>-Melvin

I'll rephrase. Is there anything knocking about which would help with
eg:
printf (pFile, "Amount %12.3f [%-10.10s]\n",balance,name);

Or do I have to rip the string apart character-by-character, then
throw all my variables about in registers, cutting, chopping and
padding them into shape, and then dumping them in iddy little bits?

Pete


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dan Sugalski  
View profile  
 More options Nov 27 2003, 1:48 pm
Newsgroups: perl.perl6.internals
From: d...@sidhe.org (Dan Sugalski)
Date: Thu, 27 Nov 2003 13:14:24 -0500
Local: Thurs, Nov 27 2003 1:14 pm
Subject: Re: Some PIR "How do I?" questions
At 5:38 PM +0000 11/27/03, Pete Lomax wrote:

Depends entirely on two things:

1) Whether we want printf-style functionality as part of the core
2) Whether you want to use it

I think the answer to #1 is a big yes. You can answer #2 as you need. :)
--
                                         Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
d...@sidhe.org                         have teddy bears and even
                                       teddy bears get drunk


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Melvin Smith  
View profile  
 More options Dec 1 2003, 10:48 pm
Newsgroups: perl.perl6.internals
From: mrjoltc...@mindspring.com (Melvin Smith)
Date: Mon, 01 Dec 2003 22:28:00 -0500
Subject: Re: Some PIR "How do I?" questions
At 01:14 PM 11/27/2003 -0500, Dan Sugalski wrote:

To me, variable interpolation means high-level language interpolation
using the high-level symbol name. printf isn't the same. I'd call it
"format interpolation", if that makes sense.

1) interpolation by the symbol name we don't need at the Parrot/IMC
level, and this was what the FAQ addressed.  I could be wrong, though.

2) printf/sprintf - we do need it (and implemented in C) since it is a
staple and is the
reasonable hook for HLL implementors to do interpolation without having
to write a special native method or PMC for each language.

-Melvin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dan Sugalski  
View profile  
 More options Dec 2 2003, 12:49 pm
Newsgroups: perl.perl6.internals
From: d...@sidhe.org (Dan Sugalski)
Date: Tue, 2 Dec 2003 09:32:36 -0500
Local: Tues, Dec 2 2003 9:32 am
Subject: Re: Some PIR "How do I?" questions
At 10:28 PM -0500 12/1/03, Melvin Smith wrote:

>2) printf/sprintf - we do need it (and implemented in C) since it is
>a staple and is the
>reasonable hook for HLL implementors to do interpolation without having
>to write a special native method or PMC for each language.

Okay, once I get the object stuff finished I think this is the next
thing to tackle. The one question is whether we should make the
lead-in character for sequences settable at runtime, as not all
languages will want to use % for interpolation. (I am, however,
perfectly fine with choosing something otherwise unused and forcing
languages to translate from their exposed form to our internal form)
--
                                         Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
d...@sidhe.org                         have teddy bears and even
                                       teddy bears get drunk


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pete Lomax  
View profile  
 More options Dec 10 2003, 11:00 am
Newsgroups: perl.perl6.internals
From: petelo...@blueyonder.co.uk (Pete Lomax)
Date: Wed, 10 Dec 2003 15:45:13 +0000
Local: Wed, Dec 10 2003 10:45 am
Subject: Re: Some PIR "How do I?" questions
On Mon, 01 Dec 2003 22:28:00 -0500, Melvin Smith

<mrjoltc...@mindspring.com> wrote:
>2) printf/sprintf - we do need it (and implemented in C) since it is a
>staple and is the
>reasonable hook for HLL implementors to do interpolation without having
>to write a special native method or PMC for each language.

Rummaging around /ops/ops.num, I spotted:

sprintf_s_s_p   1140
sprintf_s_sc_p  1141
sprintf_p_p_p   1142

(don't recall seeing sprintf mentioned elsewhere) So I tried them
(well the first two anyway), and they work.

Pete


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »