Re: Recent news about PGE
On 11/4/05, Patrick R. Michaud [EMAIL PROTECTED] wrote: As a quick example, one can now use the p6rule subrule to parse a perl 6 rule expression, and the Match object that is returned contains the parse tree. Other examples and demonstrations or parsing are in the examples/pge/ directory. pmichaud++ for getting this done. :-) I have just committed (in Parrot and Pugs) the support for the newstyle match tree for PGE::Hs, so this works now: pugs ('1' ~~ /p6rule/)p6rule Match.new( ok = bool::true, from = 0, to = 1, str = 1, sub_pos = (), sub_named = { expr = Match.new( ok = bool::true, from = 0, to = 1, str = 1, sub_pos = (), sub_named = {type = term:, value = 1} ) } ) I noticed that zero-length input is now rejected by p6rules; I tried to fix it, but could not determine where the fix should go. A trace is listed below: compilers/pge$ echo 'rule ' | parrot demo.pir Missing term at offset 0 current instr.: 'PGE::OPTable :: parse' pc 1483 (compilers/pge/PGE/Exp.pir:134) As a workaround, I special-cased m:// and m:P5// in Pugs, which may be useful anyway, as split(//, $string) is quite common. Cheers again for getting the OPTable nailed! Thanks, /Autrijus/
Re: Recent news about PGE
On 11/6/05, Patrick R. Michaud [EMAIL PROTECTED] wrote: First, for null input, PGE (and p6rules) will likely parse this by returning a Match object indicating false, and attempting to compile that object will probably return a null subroutine. Yes, that sounds sane. The other case is when there's an operator requiring a term and such a term isn't found -- i.e., an invalid expression such as $a + 5 *. I can either have pge return the portion that successfully matches (i.e., the $a + 5 part), return a false Match object, or throw an exception. At the moment I'm in favor of returning the portion that successfully matches, similar to what a rec-descent parser would do. This too, as you can trivially concat the OPTable parser with an explicit end-of-string marker. As a workaround, I special-cased m:// and m:P5// in Pugs, which may be useful anyway, as split(//, $string) is quite common. If I read S05 correctly, that now has to be split(/?null/, $string). Indeed. It's fortunate that there is a split('', $string) form. ;-) Empty rules are now an error in Pugs. Thanks for the correction! /Autrijus/
Re: Implementing perl BEGIN blocks
On Thu, Aug 18, 2005 at 04:51:58PM +0200, Leopold Toetsch wrote: There was some recent discussion [1] [2] on p6l about BEGIN blocks and constant, which is executed at compile time too. Parrot has since quite a time the @IMMEDIATE subroutine pragma, which causes execution of subs during compilation. You mean, during PIR compilation? As PMC constants are already represented as frozen images in PBC this would work for nested data strucuters, objects, and their classes too. Comments welcome, I think it's interesting, but as BEGIN blocks may affect subsequent parsing, as well as trigger compilation of other source files, I wonder how to address this. Hmm. Also I wonder about scoping issues: { my $a = $a / 2; BEGIN { $a = 10 }; } say $a; # this should to print 5 How is @IMMEDIATE going to handle this? Thanks, /Autrijus/ pgpTfSvtWXNyi.pgp Description: PGP signature
Re: Implementing perl BEGIN blocks
On Thu, Aug 18, 2005 at 06:00:43PM +0200, Leopold Toetsch wrote: This shouldn't be a problem (at least when the last few globals from imcc are gone), i.e. compilation / running code should be fully re-rentrant. Oooh, that will be much better. BTW can you explain why the above example prints 5? That was a typo. Something like this may illustrate the issue better: my $a; { my $b; BEGIN { $a = { say $b++ } } } Thanks, /Autrijus/ pgphrZdfTzFjq.pgp Description: PGP signature
Re: Parrot - Java integration
On Mon, Aug 15, 2005 at 08:07:22PM +0100, Tim Bunce wrote: Anyone given any thought to Parrot - Java integration? I have been looking at IKVM: http://www.ikvm.net/ It's basically a full Java environment but using CLR instead of JVM as the underlying runtime. The JIT conversion from Java bytecode to CIL is very interesting. It's already reasonably mature for serious applications. Thanks, /Autrijus/ pgpUvqEalC8tR.pgp Description: PGP signature
Re: Punie
On Tue, Jul 12, 2005 at 12:17:48PM -0700, Allison Randal wrote: On Jul 12, 2005, at 0:37, Autrijus Tang wrote: That's cool. In that case I'll commit the test suite from perl-1.0_16 as TODO tests to the Punie tree, if that's okay with you. :) Most welcome. I'm following a naming convention in the t/ directory of changing the original io.print-style file names to io_print.t, to make it easier to see the correspondence between the Perl 1 and Punie tests. Done as such. I have committed the five sanity tests in Perl 1.0.16's distribution, similar to the intent of geoffb's Pugs's t/01-sanity/* that helped Perl6-PIL-PIR compilation effort. Of course, the ultimate test will eventually be running the Perl 1 test suite as-is, without pre-digesting it into Parrot::Test calls. :) Actually, if Punie can pass the five sanity tests, it would be strong enough to run the tests as-is, since all they do is print strings with conditional constructs. I look forward to that day -- a TODO or ROADMAP in languages/punie/ will help, too. :-) Thanks, /Autrijus/ pgpPky2gaJhO2.pgp Description: PGP signature
Re: Punie
On Mon, Jul 11, 2005 at 11:43:55PM -0700, Allison Randal wrote: As Schwern will attest, Perl 1 is a quite complicated language, with nullary, unary, binary and ternary functions, arrays, hashes, pattern matches, transliteration, format, loop control and labels. As a test case for the Parrot compiler tools, those are certainly useful features to implement. We'll have to deal with them in more serious languages anyway. But, we'll see. I'm not promising it'll be an exact match to Perl 1 semantics, but I'd like to push it as close to supporting the full Perl 1 test suite as possible. That's cool. In that case I'll commit the test suite from perl-1.0_16 as TODO tests to the Punie tree, if that's okay with you. :) Thanks, /Autrijus/ pgpVwtL58KF40.pgp Description: PGP signature
Re: Exception handlers and calling conventions
On Mon, Jul 11, 2005 at 01:39:08PM +0200, Leopold Toetsch wrote: I can see two ways to go: a) e = interpinfo .INTERPINFO_EXCEPTION b) via the get_params opcode The latter would reflect the exception call being an internal continuation invocation: push_eh handler # throw handler:# handler: get_params (0), e # .param pmc e (Except that .param isn't allowed in arbitrary position currently) If arbitary-position .param for inner subroutines can be made to work, b) is by far more straightforward. This also plays well P6's notion that all non-local exits, including return(), are conceptually exceptions, so it makes sense to use the same pairs of calling convention opcodes. Thanks, /Autrijus/ pgpojwPM2fUDB.pgp Description: PGP signature
Re: Punie
On Mon, Jul 11, 2005 at 09:35:11PM -0700, Allison Randal wrote: I'd like to add Punie to the Parrot repository. It's a first step toward a compiler for Perl 1 running on Parrot. Currently it's *very* simple: it only parses and compiles a single statement printing a single digit -- but it uses PGE grammars and the stub in ast/ to do it. Cool! However, I wonder if Punie is indeed targetting Perl 1. As Schwern will attest, Perl 1 is a quite complicated language, with nullary, unary, binary and ternary functions, arrays, hashes, pattern matches, transliteration, format, loop control and labels. Is it Punie's goal to support all of those semantic constructs? If not, maybe call it something else than Perl 1, to avoid confusion? :) Thanks, /Autrijus/ pgpAQ7a8nf07Z.pgp Description: PGP signature
Re: Punie
On Tue, Jul 12, 2005 at 12:41:00PM +0800, Autrijus Tang wrote: Is it Punie's goal to support all of those semantic constructs? If not, maybe call it something else than Perl 1, to avoid confusion? :) (more bikesheding) If the goal is to demonstrate the capability of the upcoming expression parser and minimal AST, I think bc, the arbitrary precision calculator language, is a good candidate. Thanks, /Autrijus/ pgpRNuX7hxZBn.pgp Description: PGP signature
Re: Attack of the fifty foot register allocator vs. the undead continuation monster
On Mon, Jun 13, 2005 at 09:21:00AM -0700, Brent 'Dax' Royal-Gordon wrote: On 6/13/05, Chip Salzenberg [EMAIL PROTECTED] wrote: Oh no ... it's even worse than you think. Almost *any* opcode that operates on a PMC can trigger a continuation. And I only need two words to prove it: Tied variables. Isn't this *exactly* why Perl 6 is requiring you to mark tied variables when they're declared? Yes. And tied vars invoking full continuations is something that we can just document out of existence. Thanks, /Autrijus/ pgpFCnURsqN40.pgp Description: PGP signature
Re: Attack of the fifty foot register allocator vs. the undead continuation monster
On Mon, Jun 13, 2005 at 06:52:35PM +0200, Chip Salzenberg wrote: Isn't this *exactly* why Perl 6 is requiring you to mark tied variables when they're declared? Yes. Um: my $x is tied; tied $x, SomePackage; unsuspecting_victim(\$x); # ??? Hmm, you can't say is tied; it must be something that actually actively implementing the Tieable role (see S06): my $x is DB_File; but regardless, the DB_File thing can't invoke a full CC, so this is orthogonal to the problem we're talking about; sorry. Thanks, /Autrijus/ pgpgCzrGV28DU.pgp Description: PGP signature
Re: Regarding Google's Summer of Code 2005
On Fri, Jun 03, 2005 at 05:30:51PM +0530, Dheeraj Kumar Arora wrote: I m interseted in one of LLVM project Implement well-known optimizations in PIR compiler (SSA - register allocation) Can Any send me the details? I'm not an expert with with PIR or SSA, but I'm aware of LLVM's JIT subsystem, which can manage register allocation from an SSA representation. It was previously known as Jello -- see http://llvm.cs.uiuc.edu/ProjectsWithLLVM/#jello for a 2002 paper that discusses this topic. Also maybe of interest is ANF (A-normal form), a functional-flavoured representation closely related (and indeed translatable from) SSA. Sabry, Felleisen et al gave a useful overview in The Essence of Compiling with Continuations (Retrospective), available at http://www.ccs.neu.edu/scheme/pubs/. A translator from SSA to ANF is given in http://www.jantar.org/papers/ssa-lambda/. I'd be very happy to work with a ANF/SSA-PIR/PASM toolkit and provide feedback from the side of a compiler writer. Thanks, /Autrijus/ pgpA5TXqe5p3O.pgp Description: PGP signature
Re: Parrot as an extension language
On Fri, May 20, 2005 at 05:42:48PM +0100, Colin Paul Adams wrote: The problem I'm finding with this, is getting back the returned string characters. I assume the void * returned is pointing to a Parrot String. Certainly it's not a const char *. Yes. There is a function declaration Parrot_string_cstring in string_funcs.h, but it appears to have no definitoon anywhere, so that's not much use to me. Yeah, I bumped against that too. You need to look at the strstart field in the ParrotString struct. In Haskell I use: peekCString = #{peek STRING, strstart} s5 Thanks, /Autrijus/ pgpbLrF1rNwO3.pgp Description: PGP signature
Re: Parrot as an extension language
On Sat, May 21, 2005 at 12:53:15AM +0800, Autrijus Tang wrote: On Fri, May 20, 2005 at 05:42:48PM +0100, Colin Paul Adams wrote: There is a function declaration Parrot_string_cstring in string_funcs.h, but it appears to have no definitoon anywhere, so that's not much use to me. Yeah, I bumped against that too. You need to look at the strstart field in the ParrotString struct. Coming to think about it, we should either implement Parrot_string_cstring or take it away from the includes. I've checked in a nave implementation as r8135. Thanks, /Autrijus/ pgpUNo6gVdymw.pgp Description: PGP signature
Re: Parrot as an extension language
On Sat, May 21, 2005 at 12:53:15AM +0800, Autrijus Tang wrote: Yeah, I bumped against that too. You need to look at the strstart field in the ParrotString struct. In Haskell I use: peekCString = #{peek STRING, strstart} s5 Actually, never mind; string_to_cstring is the way to go. Thanks, /Autrijus/ pgpGlKoL0Zxas.pgp Description: PGP signature
Re: Parrot as an extension language
On Tue, May 17, 2005 at 03:00:14PM +0100, Colin Paul Adams wrote: But when I look at http://www.parrotcode.org/docs/embed.html, I can see no way of getting information back from the script - not even an exit code. Is there anyway of doing this that I have missed? You may wish to use Parrot_call_sub's SS form, where you pass in a string and get back a string. Something like this: my $interp = Parrot_new(undef); # ... load a .pir file or some other code into $interp ... my $code_pmc = Parrot_find_global( $interp, const_string(Namespace), const_string(sub_name), ); my $return_str = Parrot_call_sub( $interp, $code_pmc, const_string(SS), const_string(Your_input_string_here), ); Thanks, /Autrijus/ pgpMe8pdQExhO.pgp Description: PGP signature
Re: Remove .cvsignore?
On Fri, May 13, 2005 at 06:55:12PM +0200, Bernhard Schmalhofer wrote: As fas as I see, the only place where .cvsignore files are still used, is tools/dev/manicheck.pl. If we require 'svn', than we can replace the reading on .cvsignore with svn propget svn:ignore Is that the right was to go? I think it's correct. It also need to check for existence of a .svn directory in path before running that; if it's not there, then try svk propget svn:ignore Thanks, /Autrijus/ pgpjdR3aOxGM2.pgp Description: PGP signature
Re: small typo in PBC_COMPAT
On Wed, May 11, 2005 at 06:09:00PM -0400, Dino Morelli wrote: Feel free to correct 'no_plan'. I'll happily apply any and all patches to the tests, and those with commit privs are welcome to directly modify the t/p6rules/*.t files at any time. Speak of the devil -- I started working on more unit tests for p6rules today, starting with the things Patrick listed the other day in his PGE features update: This may be helpful, too: http://svn.openfoundry.org/pugs/t/rules/Disabled/rules.t If you'd like to converted it back to t/p6rules/*.t and included in Parrot itself, I'd be grateful. :) Thanks, /Autrijus/ pgpN5cjw2vzRY.pgp Description: PGP signature
Re: Named rules and basic OO support landed.
On Wed, May 11, 2005 at 09:19:50AM +0200, Leopold Toetsch wrote: 2) named access x = getattribute o, Point\0x This needs a full qualified attribute name Class ~ NUL ~ Attribute. That's unusable for at least Python and probably more HLLs as the compiler has to know in which class the attribute was defined. Yes. I've encountered this during my PGE::Hs hacking: .const string PGE_SUB_POS = PGE::Match\x0@:capt .const string PGE_SUB_NAMED = PGE::Match\x0%:capt I had no idea why the class name has to be fully qualified for attributes, whilst methods can be simply invoked. Pugs would have no easy way to figure out, at runtime, which attribute to dispatch to, as Perl 6 allows adding new attribute slots by eval'ing class Foo { has $.x } blocks, so attributes previously resolved as belong to a superclass may need to be redispatched. We should just have: x = getattribute o, x and the set equivalent: setattribute o, x, x It'd definitely be better if the VM can keep track of this; otherwise I'd need to marshall the whole attribute table and do a lookup each time by hand, which would be slow (and non-interoperable) indeed. Thanks, /Autrijus/ pgp1jZbbuO4io.pgp Description: PGP signature
Re: [PATCH] PGE::Hs for Pugs PGE support
On Sun, May 08, 2005 at 10:25:43PM -0500, Patrick R. Michaud wrote: On Mon, May 09, 2005 at 07:24:49AM +0800, Autrijus Tang wrote: Greetings. Attached is a patch that I'm currently using in Pugs's bundled PGE.pbc, in order to make PGE output properly escaped strings, in a format ready to be used form Haskell FFI. I'd appreciate comments, and if it's okay to commit it back to the PGE directory. Can it remain as a separate module from PGE -- say, in runtime/parrot/library/PGE/Hs.pir, rather than integrating it directly into PGE.pbc? I don't have a big problem with adding it to PGE.pbc if there's a good reason for doing it, but I'm trying to keep the PGE core itself fairly lean and then use modules to load in language-specific features. Done as such. PGE-Hs.pbc now has to be built by hand, and the default PGE.pbc no longer contains Hs.pir code. Pugs will bundle PGE-Hs.pbc with it; it is good that parrot won't built PGE-Hs.pbc by default, since that avoids version clash (as parrot searches into library/ first, not ./). Thanks! /Autrijus/ pgpUwqyeEHFMp.pgp Description: PGP signature
[PATCH] PGE::Hs for Pugs PGE support
Greetings. Attached is a patch that I'm currently using in Pugs's bundled PGE.pbc, in order to make PGE output properly escaped strings, in a format ready to be used form Haskell FFI. I'd appreciate comments, and if it's okay to commit it back to the PGE directory. Thanks, /Autrijus/ Patch - level 1 Source: [No source] Target: d31e2699-5ff4-0310-a27c-f18f2fbe73fe:/trunk/compilers/pge:8010 (http://svn.perl.org/parrot/trunk) Log: * Haskell-compatible dump of matches === PGE/Hs.pir == --- PGE/Hs.pir (revision 8010) +++ PGE/Hs.pir (patch - level 1) @@ -0,0 +1,130 @@ +=head1 Title + +PGE::Hs - Match and display PGE rules as Haskell expressions + +=head1 SYNOPSIS + +.sub _main +load_bytecode PGE.pbc +$P0 = find_global PGE::Hs, match +$S0 = $P0(Hello\n, H(.)llo(.)) +print $S0 # Just [(0, Hello\n), (1, e), (5, \n)] +.end + +=cut + +.namespace [ PGE::Hs ] + +.sub __onload +load_bytecode library/Data/Escape.imc +.end + +.sub match method +.param string x +.param string pattern +.local pmc rulesub +.local pmc match +.local pmc p6rule_compile +.local string out + +find_global p6rule_compile, PGE, p6rule +null rulesub + +rulesub = p6rule_compile(pattern) +match = rulesub(x) + match_result: +unless match goto match_fail +out = Just [ +$S0 = match.dump_hs() +concat out, $S0 +concat out, ]\n +goto end_match + match_fail: +out = Nothing\n +goto end_match + end_match: +.return (out) +.end + +.namespace [ PGE::Match ] + +.sub dump_hs method +.local pmc capt +.local int spi, spc +.local pmc iter +.local string escaped +.local pmc escape +.local string out + +out = + +unless argcS 3 goto start +unless argcS 2 goto start + start: +escape = find_global Data::Escape;, String +$I0 = self +unless $I0 goto subpats +$S0 = self +escaped = escape($S0) +$I0 = self.from() +$S0 = $I0 +concat out, ( +concat out, $S0 +concat out, , \ +concat out, escaped +concat out, \) + + subpats: +$I0 = self +capt = getattribute self, PGE::Match\x0@:capt +isnull capt, subrules +spi = 0 +spc = elements capt + subpats_1: +unless spi spc goto subrules +$S0 = spi +$I0 = defined capt[spi] +unless $I0 goto subpats_2 +$P0 = capt[spi] +bsr dumper + subpats_2: +inc spi +goto subpats_1 + + subrules: +capt = getattribute self, PGE::Match\x0%:capt +isnull capt, end +iter = new Iterator, capt +iter = 0 + subrules_1: +unless iter goto end +$S0 = shift iter +$I0 = defined capt[$S0] +unless $I0 goto subrules_1 +$P0 = capt[$S0] +bsr dumper +goto subrules_1 + + dumper: +$I0 = 0 +$I1 = elements $P0 +unless $I0 $I1 goto dumper_1 +$P1 = getprop isarray, $P0 +if $P1 goto dumper_2 +$P1 = $P0[-1] +concat out, , +$S0 = $P1.dump_hs() +concat out, $S0 + dumper_1: +ret + dumper_2: +unless $I0 $I1 goto dumper_1 +$P1 = $P0[$I0] +concat out, , +$S0 = $P1.dump_hs() +concat out, $S0 +inc $I0 +goto dumper_2 + end: +.return (out) +.end === PGE.pir == --- PGE.pir (revision 8010) +++ PGE.pir (patch - level 1) @@ -25,9 +25,12 @@ load() load = find_global PGE::P6Rule, __onload load() +load = find_global PGE::Hs, __onload +load() .end .include PGE/TokenHash.pir .include PGE/Exp.pir .include PGE/Match.pir .include PGE/P6Rule.pir +.include PGE/Hs.pir BEGIN SVK PATCH BLOCK Version: svk 0.994 (freebsd) eJx9Vftv29YVdlAs3YSkgIetS+e1uFAYwM4kmQ+ZlrXYUzo+JFm25Spp4kaGekle2pwpkuAjtQtt HR+iHrZsqxvQ7af9qzuUE2wFthkGdS/P+b7vnMtzz5HcF7+rMYOdHXpAMfSg8+VutdrGvnr6BHYU PyCa4dsutTEwyVtiUtzAtE+o8sDCfQJWH7snxN/ZYQBcuQOLC8B7knLGoWDftjxqa0HW811CKGZQ rm0MauygxgF0wIDRdojVc23bBzGG5yscWHtZTKppe6SXYcEZUODPUkz5DqAZLlFB8AJCa8vigus9 fuFafk+tGyahNjOnkmO4P3LkMqGNd0L/ZgSXLEI+o+GoygBr2h0LBAU063XvHRPbo9hBkfnfPGzG s3FnxY5jXvR8cu5rxPRxxg3vOW4Lzm9/aWnpbw+HXyUv/9KSl/4udgX7h8bZXAzvCctD4ZPdMBcK 4cdXQli6apwNxbAGyxdyuDcRoweJEOVCqftDM3ySSDgW/FDsHvj/kKI1EcshM5K61534cSr9cSoV o3Z8KIYsPCOhNG7Fh3K8HgoRI9it8Nf7ycMwUwxLUvJQCnNJI/5aTFg5xtFB8nkox00pVAAd1ZPz SFgsx2BP5eFniTzkEliPpPBbQErhczBegnsqDPVQGF4cpssJGMRhJ6nH583ha2lYk4cno6O00khF 2Mzq8c++iHjxUTNqNtL7e/FvmvGrpDU6FkJr3B4dJ51kJRSj7w5HXWlMd5MVQIdS4slDaSKlv0+k kXMw/ibcn3woTh4CHzi1w18J0UUkRX+GlEIxpuWhnx1j0pr8XJi40uSn6e4waEzO5TEdydPfQoBK c+Km9fQjOXwedlIqhJBx+nHyxfTb1pjeS5/G4tiRp8vAfzBxhVH/RpzmpeRQHj0bwg68IzE5gVUo XL4SS9nhSCkVC1NuVB+ZAIz2hjXh6vNQvNqrTx80ryry9NNo9/LrkXhVSqTo8avpvUiaLYvhL/dn bCKkH4rjlcasDXpxY7ayN9sN5csXYgn2p5d++PrqUyF6Kl7n/toE9psPhJSqXxcOrs7Emw/qaa01 W06a40edGRUfzaryzXp7dtS4+dPezG1eP6rffhLJs6B12csibF0dRvC7O70XircufCVp9rZx+5lw G3zfmN+LxHmhNV+pz17DixTCPLj8RWvox2r6k/ocQTCRMHLq868gOWW+LMz7kXzzXe35/EK6flCf
Pugs/Parrot roundtrip
I'm glad to report that Pugs is now a registered Parrot compiler: $ cat roundtrip.p6 eval_parrot ' compreg $P0, Pugs $S0 = say qq[There... and back again!] $P0 = compile $P0, $S0 invoke $P0 '; $ ./pugs roundtrip.p6 There... and back again! Once PGE has the ability to invoke callback code from the rules, it can then call back to Pugs directly, and hence finishes the basic circle needed for full bootstrapping. Enjoy, /Autrijus/ pgp8EAiJ6ZbiO.pgp Description: PGP signature
Commitership inquiry
Hey. Leo suggested to me on #parrot to drop a note on p6i, asking about obtaining the committer to the Parrot tree. As some of you know, Pugs can now evaluate PIR via an embedded Parrot interpreter: $ ./pugs -e 'eval_parrotprint 42!\n' 42! as well as compiling Perl 6 to PIR, evaluating it in memory: $ ./pugs -BParrot -e 'say The answer is: { 7 * 6 }' The answer is: 42 In light of this, I'd like to commit to Parrot tree, helping on cleaning up the embedding API, the installation process (e.g. to get the neccessary headers in place), etc. Thanks! /Autrijus/ pgp15KvlTv36Y.pgp Description: PGP signature
Pugs now embeds Parrot.
Because I want to embed PGE in Pugs, I end up embedding the entire libparrot. :-) As of two hours ago, if you set the PUGS_EMBED environment variable to parrot and run perl Makefile.PL, Pugs will build and link against Parrot, and provide a require_parrot() primitive for you. JIT works as one owuld expecte, too. Jeff Horwitz (of mod_parrot and more recently, mod_pugs fame) is now hacking away on hooking Pugs's IMC generator with the embedded Parrot, so we can have on-the-fly compilation without the need to call external pugscc. In other news, the Grin intermediate language used by JHC Haskell compiler looks very promising: http://repetae.net/john/computer/jhc/jhc.html Jhc's Grin - C compiler is only some 300 lines long, and unlike GHC, it does not link against a runtime system (RTS), so it should be relatively straightforward to make a Grin - Parrot compiler -- or even a Grin - Perl 6 compiler. Once that happens, we can then recompile Pugs with it, and finish the circle of bootstrapping. There are many other bootstrapping routes, but this one looks interesting. :-) Thanks, /Autrijus/ pgp8oRx3nBQow.pgp Description: PGP signature
Re: New version of PGE released
On Tue, May 03, 2005 at 09:22:11PM +0100, Nicholas Clark wrote: Whilst I confess that it's unlikely to be me here, if anyone has the time to contribute some help, do you have a list of useful self-contained tasks that people might be able to take on? Following some discussion on #perl6, it seems that porting the Parser part of PGE into Perl 6, using either rx// or rx:P5//, may be a good idea. Actually, porting the entirety of PGE to Perl 6 may be a good exercise for Perl 6, too. :) Thanks, /Autrijus/ pgpkDWkaIOwAg.pgp Description: PGP signature
Re: Sun Fortress and Perl 6
On Sat, Apr 30, 2005 at 08:41:52AM +0200, Leopold Toetsch wrote: Anyway Parrots MMD system depends on types. *If* the Perl6 compiler defines above array as cl = subclass FixedFloatArray, num_Array_shape_3_3_3 Yes, that is what I am planning to emit for hierarchical and other subtyped signatures. We also need to generate those for the user-defined subtype things in Perl 6. then this kind of array would be a distinct type. The other possiblity is: we have one Multi_shaped_FloatArray, which takes an initializer with the dimensions (see e.g. classes/multiarray.pmc) then all these shaped num arrays would be one type, dispatching to the same routines. Hm, I have no clue whether we can MMD based on shape of arrays. Anyone has ideas about that? Thanks, /Autrijus/ pgp5XpskHCvtN.pgp Description: PGP signature
Pugs 6.2.0 released.
I am delighted to report that the first major milestone of Pugs, version 6.2.0, has been released to CPAN: http://wagner.elixus.org/~autrijus/dist/Perl6-Pugs-6.2.0.tar.gz SIZE (Perl6-Pugs-6.2.0.tar.gz) = 642482 MD5 (Perl6-Pugs-6.2.0.tar.gz) = 8d5438d49db872ffe2394fd4995d335b It represents the culmination of 71 days of intensive work, by more than 60 people in our committer team, with nearly 2000 revisions. According to the roadmap in PA01, this and the next milestone are: 6.2: Basic IO and control flow elements; mutable variables; assignment. 6.28: Classes and traits. In other words, we are now reasonably confident that the basics of Perl 6 syntax and data structures are in place. We already have an object/type system now, and the 6.2.x series will make them available on the language leve, together with a full-fledged class system. After this release, I will take a short break from coding Pugs, and focus on writing Pugs Apocryphon 2: Design of Pugs. In it I will explain the relation of the various components in Pugs, as well as how it relates to Parrot, GHC, and other systems. Once it is written, I plan to start working on the IMC subsystem, with the goal of making Parrot IMC the primary target for the 6.28.0 release. Again, thanks too all lambdacamels for making this release possible, and for building this new ship with me. Enjoy, /Autrijus/ == Changes for 6.2.0 - April 13, 2005 === Pugs Internals * Major refactor of ITypes subsystem, we now have: ** Nested structures: `$a{1}[2]{3}` ** Autovivification: `$a{1}[2]{3} = b` ** Tied magic: `%ENVUSER` ** Proxy scalars: `%ENVPATH ~= '/tmp'` ** Slice assignment: [EMAIL PROTECTED],2] = a b` ** Anonymous arrays: `[1..10][0] = 0` ** Lazy IArray structures: Infinite lists, constant time ** Infinite slices: [EMAIL PROTECTED] ** and much much more ... * Experimental support for link external Haskell libraries ** One such module is SHA1.pm: http://tpe.freepan.org/repos/ingy/SHA1/ * New builtins: ** `sum`, `log`, `log10`, `sign`, `pi`, `tan`, `cos`, `atan` ** `zip`, `hash`, `pair`, `isa`, `bytes`, `chars`, `codes`, `graphs` * New type specific builtins; ** `.kv`, `.pairs`, `.delete`, `.exists` ** `.pick`, `.keys`, `.values` * Several file test operators ** `-r`, `-w`, `-x`, `-e`, `-z`, `-s`, `-f`, `-d` * Support for `$*UID`, `$*EUID`, `$*GID`, and `$*EGID` on *nix * Stacked file test operators now (mostly) work * Added `is rw` trait for subroutine parameters * `$*PID` now works on *nix systems * Several command line switches implemented: `-I` `-p` `-n` and more * `s:perl5/.../{ code }/` works correctly * Type casting errors are now more descriptive * `require ` now works on UTF-8 files * Regex substitution is now UTF-8 safe * `sort {}` now works * Some support for the /splat/ star `*` === Tests, Examples and Documentations * Many new tests and cleaning up of older tests, we now have 4200+ * `examples/games/hangman.p6` added which uses the `AUTHORS` file as the dictionary file * `READTHEM` added; recommended reading for aspiring Pugs hackers * The Perl 6 Cookbook is well underway at `examples/cookbook/` * Working perl6 modules added to `ext/` ** CGI.pm ** lib.pm ** HTML::Entities * Several Working Drafts added to `docs/` ** Apocalypse 20 - Debugging ** Synopsis 26 - Perl Documentation ** Synopsis 28 - Special Variables ** Synopsis 27 - Perl Culture (with CPAN drinking game rules) ** Synopsis 29 - Builtin Functions * Early work on Perl 6 Object System in `docs/class/` === Bug Fixes * Parens no longer required for; `last()` and `return()` * Fixed issue with binding invocant parameters * Fixed parsing issue with `lc $, $y` * `$_` now behaves correctly in most cases * `exit()` now triggers `END {}` correctly * `undef $x` now works correctly ($x is rw) * Fixed parsing of default parameters: `sub foo (+$x = 3, +$y = 4)` * `say` and `print` now default to `$_` * `map { ... } @list` now parses correctly * `loop { ... }` no works correctly * `int(3) + 4` now parses correctly * Fix parsefail bug on false unaries * `for (@list)` no longer flattens [EMAIL PROTECTED] * `$var.method $param` is now illegal: use `$var.method($param)` * `readline()` is now strict in list context * `$list.join('|')` now works * `xor` and `^^` now short-circuits * Named bindings to `%_` repaired pgpBxt2tZUn5h.pgp Description: PGP signature
Pugs to become a Perl6 - Parrot AST/IMC compiler.
After a IRC meeting with Leo, I've outlined my roadmap of how to make the three compiler backends in Pugs to work in concert to provide a much faster evaluator: http://use.perl.org/~autrijus/journal/23890 Note that existing code in the Eval monad need not be rewritten; also Pugs will still run Perl 6 code without a parrot installation, by compiling IMC to Haskell on the fly and executing it. More details and code will follow shortly; suggestions and feedbacks to this plan are very welcome! Thanks, /Autrijus/ pgpnsLgBxmmbN.pgp Description: PGP signature
Re: pugscc --runparrot -e 'Hello, Parrot'.say
On Sat, Mar 26, 2005 at 04:44:52PM +0100, Leopold Toetsch wrote: I had a look at the generated mandel.imc. Remarkable, how compact Parrot.hs is and what it already does. Thanks. One of my remaining large TODOs before Pugs 6.2.0 is to recode the evaluators in Template Haskell as Compile/Haskell.hs, so all code is always compiled. The Template Haskell macros should then be rewritten into something resembling your ast/ast.h, which is an AST for generating syntactically and semantically correct PIRs, without the need of hard coding any strings using PrettyPrinter. I'd very much like to talk with you about Compile/Parrot/AST.hs the next week -- IRC or SEE/MoonEdit/Skype if possible. I understand you're on metered ISDN, and I'd gladly pay for your bandwidth fee. :) But if mails are preferred for you, I can do that as well. 1) s__z = s__t # mandel.imc:149 This aliases the two PMCs, it's specifically not an assignement. It's: set Px, Py # PREG(1) = PREG(2); both PMC registers point to the same thing then. Aha! Thanks for the hint. I see that the form above should perhaps be used for :=, not =. Fixed as r1200. 2) Parrot understands two forms of source line comments: a) C-like: #line file line I'll use this for now; r1201. b) opcodes: setfile file setline line What, no set-column? :-) 3) the last Continuations Understood, will fix along with the AST refactoring. 4) substr shortut Thanks, implemented as r1203. Please let us know, what else is needed in the near future. I will definitely collect issues raised during my tomorrow's YAPC::Taipei talk and get back to you. Thanks, /Autrijus/ pgpRnpz7chLP6.pgp Description: PGP signature
pugscc --runparrot -e 'Hello, Parrot'.say
(Cc'ing this post to p6i and p6l, as this is likely to concern folks from all three mailing lists.) As of Pugs revision 1024, this works: % pugscc --runparrot -e 'Hello, Parrot'.say And yes, it does what you think it does. Pugs takes that Perl 6 source code, produce an AST, triggers the Compiler backend, generates some PIR code, saves it into a.pir, and runs it with the parrot executable in path. The compilation and execution speed are both very fast, and will get faster with embedded Parrot and/or Ponie support in the future. This also works: % pugscc --runhaskell -e 'Hello, Haskell'.say Instead of PIR, it generates raw Haskell code using Template Haskell, compiles it with GHC, and runs the resulting executable. Template Haskell is really good for prototyping and verifying a compiler; the code it produces is also quite fast, within 20% of Perl 5 speed. The old, undecorated form of pugscc also works. It can also be written thus: % pugscc --runpugs -e 'Hello, Pugs'.say The --pugs backend is the only one that guarantees to run identically to the pugs interpreter. Unsurprisingly, it merely bundles the evaluator with the Pugs AST, and makes an executable out from that. On a somewhat more interesting note, if you can build Pugs with the PUGS_EMBED environment variable set to perl5 (that works on FreeBSD for me, but apparntely not on many other platforms), then you can do this: % pugscc --runpugs -e eval_perl5('print q[Hello, Perl5!]') The eval_perl5($str) form is but a temporary kluge; it will likely become eval($str, :languageperl5), or whatever form preferred by the perl6 design folks. Suggestions welcome! Aside from perl5, I plan to add embedding support for Haskell and C via hs-plugins, and Parrot support via the embedding API. Of course, once Ponie gets up to speed, I can replace Perl5 and Parrot embeds with it, which will save a lot of value casting works. Tomorrow I'll hack some more to get mandel.p6 working correctly on the two new compiler backends. Thanks to Dan Sugalski's help on #parrot, I have figured out the PIR-level supports to get this done. Parrot is really much, much saner than I had hoped; it eeriely supports lots of things needed by a Perl 6 implementation. I wonder why that is the case. :-) Thanks, /Autrijus/ pgpjbdYzb2OgT.pgp Description: PGP signature
Pugs 6.0.0 released.
(Sorry for the cross-posting; announcement of future releases will appear only on the perl6-compiler list.) Quite appropriately, on Day 6 of Pugs, I have released Pugs 6.0.0. It should be on a CPAN near you in a few hours, under the Perl6::Pugs namespace. You may install it from the CPAN shell just like any other CPAN module, provided that you have GHC on your system. This initial release offers the following features: * Evaluation of most simple Perl6 expressions. * Junctions and chained comparisons. * Interactive shell and #!/usr/bin/pugs support. See the Perl6::Pugs POD for more details. I will keep an implementor's journal in use.perl: http://use.perl.org/~autrijus/journal/ Project-related information are currently kept on the Haskell Wiki: http://autrijus.org/pugs/ Special thanks to many people on irc.perl.org #perl, especially Juerd, for last-minute testing. Also I'd like to thank freenode #haskell for tolerating my newbie questions, as well as various helpful clarifications from perl6-language. Cheers! :-) Feedbacks, patches, ideas and other suggestions are very much welcome. Thanks, /Autrijus/ pgpdNSLwsqCak.pgp Description: PGP signature
Re: ICU and Parrot
On Sat, Jun 01, 2002 at 02:20:15AM +0900, Dan Kogai wrote: 2) If not, would a Encode::ICU be wise? I'm not so sure. But if I were the one to implement Encode::ICU, it will not be just a compiled collection of UCM files but a wrapper to all library functions that ICU has to offer. I, for one, am too lazy for that. That would be Text::Uconv's job, wouldn't it? Then Encode::ICU could just interface to that module instead. 3) A number of encodings are in HanExtra but not their ucm repository, namedly big5plus, big5ext and cccii. Is is wise to feed back to them under the name of e.g. perl-big5plus.ucm? You should in time and I should, too, because I have expanded UCM a little so that you can define combined characters commonly seen in Mac*. But I don't see any reason to be in hurry for the time being. Understood. In a related note: http://www.li18nux.org/docs/html/CodesetAliasTable-V10.html has spurred quite a bit discussion in Taiwan because of the mandated standardization of Big5 = TCA-BIG5, and Big5-HKSCS = HKSCS-BIG5 (i.e. the standard body first.) But it struck me as making lots of sense, if in a rather rigid way. Should Encode.pm probably add them to the Alias table, in the name of 'practical'? In particular, supporting CP-xxx (= CPxxx) and ISO-646-US (= US-ASCII) should be rather beneficial. /Autrijus/ msg09924/pgp0.pgp Description: PGP signature