particle's Journal http://use.perl.org/~particle/journal/ particle's use Perl Journal en-us use Perl; is Copyright 1998-2006, Chris Nandor. Stories, comments, journals, and other submissions posted on use Perl; are Copyright their respective owners. 2012-01-25T02:24:21+00:00 pudge pudge@perl.org Technology hourly 1 1970-01-01T00:00+00:00 particle's Journal http://use.perl.org/images/topics/useperl.gif http://use.perl.org/~particle/journal/ Parrot Developer Summit 2008 Recap http://use.perl.org/~particle/journal/37905?from=rss <p>Much of my volunteer time over the past few weeks has been devoted to the organization of Parrot Foundation's first Parrot Developer Summit, which took place this past weekend in Mountain View, CA. Our primary objective was to write a roadmap to the release of Parrot 1.0 and beyond. Secondary objectives included review and discussion on support and release policies, updates on parrot subsystems and milestones, review of Parrot Foundation topics, and knowledge transfer between attendees.</p><p>To achieve these goals, we brought together Parrot Foundation directors, core Parrot developers and high-level language designers to spent two days in conference. During the meetings we used a number of agile techniques, and achieved amazing results. You can find our vision outlined in <a href="http://use.perl.org/~chromatic/journal/37889">chromatic's journal</a>, and further discussed in <a href="http://groups.google.com/group/parrot-dev/browse_thread/thread/724c927c208a77b5">this parrot-dev mailing list thread</a>.</p><p>Notably, <a href="https://trac.parrot.org/parrot/wiki/ParrotRoadmap">a roadmap</a> for Parrot has been made available on the parrot.org wiki, which will be updated as work progresses. This roadmap is a detailed and organized description of tasks which must be completed to achieve our goals, and it serves as an excellent place to judge the Parrot team's progress against release milestones. This document is a first for Parrot, and I hope it shows the maturity of the project team, and our commitment to meeting our published milestones. It allows our contributors to focus on the tasks remaining, and is an invaluable communication tool for the community.</p><p>Without the sponsorship of our advisory board members, the facilites provided by Google, and the support of the Parrot Foundation membership, this summit would not have been possible. Thanks all for your contributions, enthusiasm, and support.</p><p> ~jerry</p> particle 2008-11-18T21:54:38+00:00 parrot [rakudo] new perl6doc executable http://use.perl.org/~particle/journal/35555?from=rss <p>i want very much for rakudo to feel like perl, as soon as possible. therefore, i've been concentrating on adding command-line options and utilities that perl programmers expect. yesterday, i added a first approximation of 'perl6doc'.</p><p>view the patch here: <a href="http://perlsix.org/svn/parrot/revision/?rev=25389">http://perlsix.org/svn/parrot/revision/?rev=25389</a></p><p>it's far from complete. however, it should provide a start to folks interested in hacking the POD grammar. jeff horwitz would like to work on a pod2html mod_parrot handler. what would you like to see? we need your help.</p><p>you can create a perl6doc from a parrot working copy with the following commands, after compiling parrot:</p><p> &nbsp; &nbsp; cd languages/perl6 &amp;&amp; cd src/utils &amp;&amp; make perl6doc<br> &nbsp; &nbsp; # that's probably 'perl6doc.exe' if you're on windows</p><p>try running it on some of the files under languages/perl6. see what you find. ask questions. fix what's broken. get involved!</p><p>related links:</p><p>Synopsis 26 - Documentation:<br><a href="http://perlcabal.org/syn/S26.html">http://perlcabal.org/syn/S26.html</a></p><p>Perl6::Perldoc on CPAN:<br><a href="http://search.cpan.org/~dconway/Perl6-Perldoc-v0.0.5/">http://search.cpan.org/~dconway/Perl6-Perldoc-v0.0.5/</a></p> particle 2008-02-01T19:51:08+00:00 perl6 [perl6]: implement evaluation of one-liners http://use.perl.org/~particle/journal/35377?from=rss <p>since my previous commit enabled one-liners for all compilers based on PCT, this extremely simple commit adds '-e' to the list of switches that perl6 allows, and documents the switch syntax in the help message.</p><p>view the patch here: <a href="http://perlsix.org/svn/parrot/revision/?rev=24796">http://perlsix.org/svn/parrot/revision/?rev=24796</a></p><p>so begins the age of the perl6 JAPH.</p> particle 2008-01-12T18:56:48+00:00 perl6 [pct]: implement one-liners for compilers http://use.perl.org/~particle/journal/35376?from=rss <p>since evaluating one-liners is a popular option for compilers, i've implemented it in the Parrot Compiler Toolkit.</p><p>view the patch here: <a href="http://perlsix.org/svn/parrot/revision/?rev=24795">http://perlsix.org/svn/parrot/revision/?rev=24795</a></p><p>the first difference adds '-e' as a valid command line option.</p><p>the next set of differences refactors argument processing out of the 'command_line' method into its own method, 'process_args'. this should allow greater flexibility for compilers based on PCT::HLLCompiler.</p><p>the last two differences process the '-e' option: if the option was set, the 'eval' method is called to process the line of code that was passed.</p> particle 2008-01-12T18:54:53+00:00 parrot Perl 6 Test Suite Refactor - new compiler directives http://use.perl.org/~particle/journal/35369?from=rss <p>in my last journal entry, i described the file and directory naming for the official Perl 6 specification tests. this will make it easier for Perl 6 implementors to find tests related to the pieces of the compiler under construction, and will encourage what i like to call "specification-driven development" -- write the spec first, then the tests, then the implementation.</p><p>here i'll address a critical bit of infrastructure necessary to write a test suite destined to be run by multiple implementations. since the various implementations of Perl 6 will be sharing the same test suite, we can't mark tests that are todo or should be skipped as done in a typical CPAN module. each implementation will need to classify its own set of failing tests that should be skipped or marked todo. here's a list of our guiding principles:</p><p>~ the skip/todo classification should be as close to the test as possible.<br> &nbsp; &nbsp; we'd like to avoid a situation where there's one big file that has a list<br> &nbsp; &nbsp; of skip/todo. this is fragile, because as tests are modified, maintained,<br> &nbsp; &nbsp; and refactored, it will be quite difficult to keep this solution working--<br> &nbsp; &nbsp; especially across multiple implementations.</p><p>~ compilers should recognize only the directives that impact them.<br> &nbsp; &nbsp; we need to be sure that kp6 doesn't run directives intended for pugs, etc.</p><p>~ the directives may be used for purposes outside the realm of testing.<br> &nbsp; &nbsp; although testing Perl 6 is the driving requirement for this solution,<br> &nbsp; &nbsp; and we have no other plans for these compiler directives at this time,<br> &nbsp; &nbsp; we recognize that it's likely that they'll be useful elsewhere.<br> &nbsp; &nbsp; therefore, we're designing it in from the start.</p><p>various bits of syntax were offered, but we've settled on the following:</p><p>~ compiler directives will look like a comment to all other compilers<br> &nbsp; &nbsp; in order to achieve this, we've settled on a prefix of '#'.</p><p>~ compiler directives are conditional by design (they're complier-dependent)<br> &nbsp; &nbsp; we append a '?' to the prefix to better reflect their conditional nature.</p><p>~ a compiler token must be specified<br> &nbsp; &nbsp; compilers need a token to know which directives are intended specifically<br> &nbsp; &nbsp; for them. we've chosen the compiler name.<br> &nbsp; &nbsp; (e.g. 'perl6', 'kp6', or 'pugs')</p><p>~ the marker should be visually offset from the body<br> &nbsp; &nbsp; purely for humans to make it a little easier to see, we've put a colon (':')<br> &nbsp; &nbsp; after the compiler name.</p><p>~ any Perl 6 term can follow a compiler directive<br> &nbsp; &nbsp; we don't have any need for multi-line directives at the moment,<br> &nbsp; &nbsp; so we haven't invented any syntax to support it.</p><p>putting it all together, the compiler directives look like this, shown inside a simple test file:</p><p> &nbsp; &nbsp; use Test;<br> &nbsp; &nbsp; plan 3;</p><p> &nbsp; &nbsp; #?perl6: todo( 'not yet implemented', 1 );<br> &nbsp; &nbsp; #?pugs: todo( 'feature', 3 );<br> &nbsp; &nbsp; #?kp6: skip( 'does not parse', 2 );<br> &nbsp; &nbsp; ok( 0, 'foo' );<br> &nbsp; &nbsp; ok( 1, 'bar' );<br> &nbsp; &nbsp; is( 1, 1, 'baz' );</p><p>given those directives, perl6 will mark the first test todo, pugs will mark all three tests todo (which should result in two bonus todo tests passing,) and kp6 will skip the first two tests. running these tests will result in all tests passing for each of these three implementations.</p><p>i've implemented this compiler directive syntax in the perl6 compiler, as well as these forms of 'todo()' and 'skip()'. i've included links to those commit diffs below.</p><p>i'll follow up soon with more information about the forms of 'todo()' and 'skip()' shown above, as well as two new test directives that will take advantage of this compiler syntax to mark blocks of tests.</p><p>related links:</p><p>Perl 6 Test Suite Refactor - file and directory naming:<br><a href="http://use.perl.org/~particle/journal/35366">http://use.perl.org/~particle/journal/35366</a></p><p>perl6 grammar:<br><a href="http://svn.perl.org/parrot/trunk/languages/perl6/src/parser/grammar.pg">http://svn.perl.org/parrot/trunk/languages/perl6/src/parser/grammar.pg</a></p><p>[perl6]: support compiler directives with syntax '#?perl6: '<br><a href="http://perlsix.org/svn/parrot/revision/?rev=24740">http://perlsix.org/svn/parrot/revision/?rev=24740</a></p><p>[perl6]: add todo() to Test.pm<br><a href="http://perlsix.org/svn/parrot/revision/?rev=24751">http://perlsix.org/svn/parrot/revision/?rev=24751</a></p> particle 2008-01-11T21:29:01+00:00 perl6 Perl 6 Test Suite Refactor - file and directory naming http://use.perl.org/~particle/journal/35366?from=rss <p>after conversations with larry and patrick, including a mailing list thread linked below, we've decided on a strategy for file and directory naming for the official Perl 6 specification tests currently stored in the pugs repository.</p><p>the directory structure looks like this:</p><p> &nbsp; &nbsp; t/spec/<br> &nbsp; &nbsp; &nbsp; &nbsp; S02-literals/<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; radix.t<br> &nbsp; &nbsp; &nbsp; &nbsp; S02-whitespace/<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; comments.t<br> &nbsp; &nbsp; &nbsp; &nbsp; S03-operators/<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; autoincrement.t<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; comparison.t<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; equality.t<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; relational.t<nobr> <wbr></nobr>...<br> &nbsp; &nbsp; &nbsp; &nbsp; S29-functions/<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; str/<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; substr.t</p><p>please note the following:</p><p>~ the root directory for all specification tests is 't/spec/'<br>~ the top level directories under the root are named after the synopsis number<br> &nbsp; &nbsp; and the section of the synopsis to which the contained test files correspond<br>~ top level directories may contain subdirectories<br>~ test file names reflect the subject being tested</p><p>i'll follow up soon with information about migrating tests to this new structure, and about new compiler directives allowing these tests to be used across Perl 6 implementations.</p><p>related links:</p><p>mailing list thread:<br><a href="http://groups.google.com/group/perl.perl6.compiler/browse_frm/thread/5c622e222e34b8f5/ed748490f030da2f?tvc=1&amp;q=Proposal%3A+refactor+the+test+suite+according+to+synopsis#ed748490f030da2f">http://groups.google.com/group/perl.perl6.compiler/browse_frm/thread/5c622e222e<nobr>3<wbr></nobr> 4b8f5/ed748490f030da2f?tvc=1&amp;q=Proposal%3A+refactor+the+test+suite+according+to<nobr>+<wbr></nobr> synopsis#ed748490f030da2f</a></p><p>pugs repository tests:<br><a href="http://svn.pugscode.org/t">http://svn.pugscode.org/t</a></p> particle 2008-01-11T17:47:06+00:00 perl6 [perl6]: implement syntax checking (-c) http://use.perl.org/~particle/journal/35343?from=rss <p>similar to previous entries on adding command line options to perl6, here i'm adding a syntax check option, '-c'. in order to do this, i've added a custom syntax checking stage to the compiler stages after the abstract syntax tree has been generated. this ensures that 'BEGIN' and 'CHECK' blocks have been executed before syntax is checked, which matches Perl 5's behavior.</p><p>view the patch here: <a href="http://perlsix.org/svn/parrot/revision/?rev=24712">http://perlsix.org/svn/parrot/revision/?rev=24712</a></p><p>the first difference takes the attribute values that were previously inherited directly from 'PCT::HLLCompiler' and moves them into 'Perl6::Compiler', so i can modify them. i've added a new stage called 'check_syntax' after the 'past' stage, and added the 'c' option to the list of command line options.</p><p>the next difference adds usage text for '-c'.</p><p>the last difference implements the 'check_syntax' compiler method. like other compiler stages (found in 'PCT::HLLCompiler', 'check_syntax' has two formal parameters: 'source' is the object that is expected as input, and 'adverbs' is a hash containing options passed in to that compiler stage.</p><p>q{ $I0 = adverbs['c'] } tells me if the '-c' option has been passed to perl6. if it hasn't been passed, then return and move on. if '-c' has been passed, then we're checking syntax. now here's a big cheat, because if i've made it to the 'check_syntax' method, i must have generated valid PAST already, which means syntax checks out OK. so, i print out a nice message and exit gracefully. if there has been a parsing error, a previous compiler method ('parse' or 'past') would have complained and displayed the errors with backtrace info to the user.</p><p>this isn't quite perfect, but it's a good first approximation--indeed good enough to be useful, and a simple example of adding a compiler stage to a compiler built with PCT.</p><p>related links:</p><p>PCT::HLLCompiler source:<br><a href="http://svn.perl.org/parrot/trunk/compilers/pct/src/PCT/HLLCompiler.pir">http://svn.perl.org/parrot/trunk/compilers/pct/src/PCT/HLLCompiler.pir</a></p> particle 2008-01-10T00:04:59+00:00 perl6 [perl6]: subclass PCT::HLLCompiler http://use.perl.org/~particle/journal/35342?from=rss <p>as the perl6 compiler grows, it needs more and more customization. in order to make it easier to customize, today i decided that rather than having 'Perl6::Compiler' be an instance of 'PCT::HLLCompiler', it was time to make it a subclass. this was incredibly easy.</p><p>view the patch here:<br><a href="http://perlsix.org/svn/parrot/revision/?rev=24706">http://perlsix.org/svn/parrot/revision/?rev=24706</a></p><p>previously all the initialization code in perl6.pir ran during library load. a 'PCT::HLLCompiler' object was created, attribute values were assigned, etc. now, we'll generate a subclass at library load time, and inside the 'init' method of the subclass we'll deal with attribute assignment and the like.</p><p>the first difference is in the 'onload' subroutine. i load the 'Protomaker' bytecode, which allows me to work with parrot protoobjects. first, i get the 'Protomaker' protoobject and stash it in the virtual register $P0. next, i get the 'PCT::HLLCompiler' class, and then i call the 'new_subclass' method on Protomaker to create a new subclass of 'PCT::HLLCompiler' named 'Perl6::Compiler'. that ends the 'onload' subroutine, and initialization continues in the 'init' vtable method.</p><p>in the next differences, there are two things going on. firstly, i remove the call to create a new PCT::HLLCompiler, since 'Perl6::Compiler' is now a subclass. secondly, inside parrot methods 'self' is automatically defined, so the remaining differences are simply to replace the virtual register '$P0' with the keyword 'self'.</p> particle 2008-01-09T23:31:50+00:00 perl6 [perl6]: implement usage message (-h, --help) http://use.perl.org/~particle/journal/35302?from=rss <p>my last entry (<a href="http://use.perl.org/~particle/journal/35300">http://use.perl.org/~particle/journal/35300</a>) described how i added support to the Parrot Compiler Toolkit to support a '--help' command line option for compilers. my next commit enables this option for perl6.</p><p>view the patch here: <a href="http://perlsix.org/svn/parrot/revision/?rev=24554">http://perlsix.org/svn/parrot/revision/?rev=24554</a></p><p>since i laid the foundation for implementing usage messages in PCT, it was easy to customize it for perl6. i'll walk through it briefly.</p><p>the first difference is in the 'onload' subroutine, which is run when the perl6 bytecode is loaded by parrot. after a new HLLCompiler object has been created, i create a new String PMC using a parrot heredoc containing the help text for the command line options specific to perl6. since @larry hasn't written S19, the synopsis on the perl 6 command line interface, these options are likely to change.</p><p>the second difference implements the 'usage' method that HLLCompiler calls when the '-h' or '--help' option is passed. if an argument is not passed for the optional parameter 'name', it is defaulted to 'perl6'. a usage message is printed containing the contents of 'name' and the '$usage' attribute of the HLLCompiler object as set above, and the program exits.</p><p>based on the techniques i've used to implement '--help', it should be straightforward to implement similar command line options for the perl6 compiler.</p><p>related links:</p><p>perl 6 synopses:<br><a href="http://perlcabal.org/syn/">http://perlcabal.org/syn/</a></p> particle 2008-01-06T00:49:25+00:00 perl6 [pct]: implement usage messages for compilers http://use.perl.org/~particle/journal/35300?from=rss <p>there are certain features that many compilers share, and one of them is a command line interface. andy lester has started entering tickets for perl 6 features in the perl6 request tracker, and after thinking about implementing this for perl6, patrick and i decided that many compilers will want this functionality, so it makes sense to make it available in the Parrot Compiler Toolkit (PCT) HLLCompiler object.</p><p>the HLLCompiler object provides an interface for common high-level language compiler tasks. it allows you to implement a command line interface, compile from a file, and gives you an interactive compiler mode which evaluates standard input one line at a time.</p><p>HLLCompiler also allows you to set the transformation stages used to produce something executable from your source code. for perl6, that's source code -&gt; parse tree -&gt; abstract syntax tree (PAST) -&gt; object syntax tree (POST) -&gt; parrot intermediate representation (PIR). PIR is fed to parrot's intermediate code compiler (IMCC) to be executed. HLLCompiler's 'compile' method sets the process in motion.</p><p>although HLLCompiler offers a generic method for compilers invoked from command line, there are some options common to most compilers (indeed most programs) that would be helpful to add; '--help' is one of these options, and the subject of this patch.</p><p>view the patch here: <a href="http://perlsix.org/svn/parrot/revision/?rev=24550">http://perlsix.org/svn/parrot/revision/?rev=24550</a></p><p>this patch does four basic things: refactors a hardcoded list of command line arguments into an attribute; adds an attribute containing usage text; handles processing of the '--help' option; and adds a usage method called from '--help'.</p><p>the first difference in the report adds two attributes to the HLLCompiler object, '@cmdoptions' and '$usage'. the names of the attributes are listed in a space separated string, which is an argument to parrot's 'split' operator. 'split' returns a PMC of type 'ResizableStringArray', which is stored in a virtual register named $P1. the list of attributes in $P1 is flattened and passed to the 'new_subclass' method of a 'Protomaker' object, which generates a parrot protoobject of type 'PCT::HLLCompiler' that includes a list of attributes with the names passed in. all this occurs when the HLLCompiler bytecode is loaded.</p><p>the next difference is in HLLCompiler's 'init' vtable function (and method), which is executed when a HLLCompiler protoobject's 'new' method is called. here, i've added values to the new attributes, '@cmdoptions' and '$usage'. '@cmdoptions' contains an array of command line options in getopts syntax. '$usage' contains a text prelude, followed by a header for the options section, and then a list of the command line options in '@cmdoptions' appended one per line.</p><p>the third difference removes the previously hardcoded list of command line options passed to the getopts object (via parrot's 'push' opcode), and replaces it with code that gets the array from '@cmdoptions' and passes each item in the array iteratively.</p><p>the fourth and fifth differences appear in the 'command_line' method of HLLCompiler, and process the '-h' or '--help' command line options. if either option is found via getopts and stored in the 'adverbs' hash, the 'usage' method is called, passing the program name (stored in the register named 'arg0'.)</p><p>the sixth and final difference defines the new 'usage' method. 'usage' takes an optional parameter which prints it's value if passed. then 'usage' prints the contents of the '$usage' attribute stored in HLLCompiler, and exits.</p><p>so, this patch provides a simple (however ugly) help text for any compiler implemented with the PCT, and allows these compilers to override the default behavior and implement a customized (and hopefully more useful) help message.</p><p>related links:</p><p>perl6 request tracker:<br><a href="http://rt.perl.org/rt3/Search/Results.html?Query=Queue%20%3D%20'perl6'">http://rt.perl.org/rt3/Search/Results.html?Query=Queue%20%3D%20'perl6'</a></p><p>submit requests to the perl6 request tracker by mail:<br><a href="mailto:perl6-bug@perl.org">mailto:perl6-bug@perl.org</a></p><p>parrot object model design document (PDD15):<br><a href="http://svn.perl.org/parrot/trunk/docs/pdds/pdd15_objects.pod">http://svn.perl.org/parrot/trunk/docs/pdds/pdd15_objects.pod</a></p> particle 2008-01-05T22:03:22+00:00 parrot parrot and perl 6 posts - more to come http://use.perl.org/~particle/journal/35295?from=rss <p>i've been working on parrot and perl 6 for some time now. i have a fairly good understanding of the design, deep knowledge of parrot and perl6 internals, and a good sense of perl and parrot history.</p><p>i've read some fantastic articles, tutorials, wiki pages, and journal entries, which have informed me and kept me excited about working on these projects.</p><p>perl6 is now at a point where it's ready to take off... parrot now provides us with most of the tools we need to build a perl 6 compiler, and parrot contributors are working hard and fast to complete the remaining incomplete subsystems.</p><p>it's well past time i write about my contributions, in order to inform others about my parrot and perl 6 activities. i intend to explain my implementation activities on both projects by describing my commits, and topics related to designing, implementating, and testing parrot and perl6.</p><p>more to come.</p> particle 2008-01-05T15:24:04+00:00 perl6