Re: Compile op with return values

2004-09-01 Thread Leopold Toetsch
Steve Fink [EMAIL PROTECTED] wrote: ... Leo's @ANON implementation of your scheme works great for me (I have no problem wrapping that around my code.) All this does raise the question of garbage collection for packfile objects; is there any? Not yet. We basically have two kinds of

Re: Compile op with return values

2004-08-31 Thread Leopold Toetsch
Dan Sugalski wrote: At 4:09 PM +0200 8/30/04, Leopold Toetsch wrote: The PIR compiler needs compilation units. If the compiler is PASM, it'll compile whatever is fed to it. We can have an implied compilation unit if things are properly set up. I think that's not unreasonable if we can work out

Re: Compile op with return values

2004-08-31 Thread Dan Sugalski
At 9:56 AM +0200 8/31/04, Leopold Toetsch wrote: Dan Sugalski wrote: At 4:09 PM +0200 8/30/04, Leopold Toetsch wrote: The PIR compiler needs compilation units. If the compiler is PASM, it'll compile whatever is fed to it. We can have an implied compilation unit if things are properly set up. I

anonymous subs (was: Compile op with return values)

2004-08-31 Thread Leopold Toetsch
Dan Sugalski wrote: ... The inability to compile and return truly anonymous subs in PIR is, by itself, enough to warrant the change. Ok. What about: .sub @ANON .end What else is needed for anoymous subs? How do we get at the subroutine object, if the anon sub is compiled statically? leo

Re: anonymous subs (was: Compile op with return values)

2004-08-31 Thread Dan Sugalski
At 5:16 PM +0200 8/31/04, Leopold Toetsch wrote: Dan Sugalski wrote: ... The inability to compile and return truly anonymous subs in PIR is, by itself, enough to warrant the change. Ok. What about: .sub @ANON .end Still runs into the issue of not returning a sub PMC to use. I can see not wanting

Re: Compile op with return values

2004-08-31 Thread Steve Fink
On Aug-30, Dan Sugalski wrote: I've been watching this thread with some bemusement -- I've got to admit, I don't see the problem here. I'm not sure what the point of passing in parameters to the compilation is. (Not that I don't see the point of having changeable settings for compilers,

Re: Compile op with return values

2004-08-29 Thread Leopold Toetsch
Steve Fink [EMAIL PROTECTED] wrote: [ passing arguments to compilers ] ... So why does the compile op exist? Your concerns are all valid. The compiler interface needs extension as well as some cleanup. This is true for compilers written in C (loadable as shared libs) and for compilers written

Re: Compile op with return values

2004-08-28 Thread Steve Fink
On Aug-26, Leopold Toetsch wrote: Steve Fink wrote: I can store some global counter that makes it generate different sub names each time, but that seems a bit hackish given that I don't really want the subroutine to be globally visible anyway; I'm just using one so that I can use PIR's

Re: Compile op with return values

2004-08-28 Thread Steve Fink
On Aug-27, Leopold Toetsch wrote: Steve Fink wrote: On Aug-26, Leopold Toetsch wrote: .sub @regex_at_foo_imc_line_4711 # e.g. Yes, this illustrates what I was really getting at. My compiler can certainly take a subroutine name (or file and line number, or whatever) to use to generate

Re: Compile op with return values

2004-08-27 Thread Leopold Toetsch
Steve Fink wrote: On Aug-26, Leopold Toetsch wrote: .sub @regex_at_foo_imc_line_4711 # e.g. Yes, this illustrates what I was really getting at. My compiler can certainly take a subroutine name (or file and line number, or whatever) to use to generate the code with, but what is the proper way to

Re: Compile op with return values

2004-08-26 Thread Steve Fink
On Aug-22, Leopold Toetsch wrote: Steve Fink [EMAIL PROTECTED] wrote: I am experimenting with registering my own compiler for the regex language, but the usage is confusing. It seems that the intention is that compilers will return a code object that gets invoked, at which time it runs

Re: Compile op with return values

2004-08-26 Thread Leopold Toetsch
Steve Fink wrote: Right now, I always compile to the same subroutine name _regex, and ... But is this safe to rely on, or will it later become an error to override a global subroutine? I think yes. Overriding a subroutine should be possible. I can store some global counter that makes it generate

Re: Compile op with return values

2004-08-23 Thread Dan Sugalski
At 11:03 PM -0700 8/21/04, Steve Fink wrote: I am experimenting with registering my own compiler for the regex language, but the usage is confusing. It seems that the intention is that compilers will return a code object that gets invoked, at which time it runs until it hits an Cend opcode. But

Re: Compile op with return values

2004-08-23 Thread Gregor N. Purdy
Hmmm... Wouldn't a C compiler want to return a sub that invoked the main() (if there was one)? And, if there wasn't one, wouldn't the C compiler want to return a sub that raised an exception? Regards, -- Gregor Dan Sugalski wrote: At 11:03 PM -0700 8/21/04, Steve Fink wrote: I am experimenting

Re: Compile op with return values

2004-08-23 Thread Dan Sugalski
At 6:41 AM -0700 8/23/04, Gregor N. Purdy wrote: Hmmm... Wouldn't a C compiler want to return a sub that invoked the main() (if there was one)? Nope, it shouldn't. main() would go into the symbol table and if you wanted to invoke it you'd yank it out and do so. And, if there wasn't one,

Re: Compile op with return values

2004-08-23 Thread Mark A. Biggar
Dan Sugalski wrote: At 11:03 PM -0700 8/21/04, Steve Fink wrote: I am experimenting with registering my own compiler for the regex language, but the usage is confusing. It seems that the intention is that compilers will return a code object that gets invoked, at which time it runs until it hits an

Re: Compile op with return values

2004-08-23 Thread Dan Sugalski
At 7:13 AM -0700 8/23/04, Mark A. Biggar wrote: Dan Sugalski wrote: At 11:03 PM -0700 8/21/04, Steve Fink wrote: I am experimenting with registering my own compiler for the regex language, but the usage is confusing. It seems that the intention is that compilers will return a code object that gets

Compile op with return values

2004-08-22 Thread Steve Fink
I am experimenting with registering my own compiler for the regex language, but the usage is confusing. It seems that the intention is that compilers will return a code object that gets invoked, at which time it runs until it hits an Cend opcode. But what if I want to return some values from the