Bernhard's Journal http://use.perl.org/~Bernhard/journal/ Bernhard'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:44+00:00 pudge pudge@perl.org Technology hourly 1 1970-01-01T00:00+00:00 Bernhard's Journal http://use.perl.org/images/topics/useperl.gif http://use.perl.org/~Bernhard/journal/ Basic OO-features in Pipp http://use.perl.org/~Bernhard/journal/39168?from=rss <p> When starting on the ReflectionExtension class for Pipp, I got reminded that some very basic OO-features were not working yet. The good think is that I can all that stuff from Rakudo. So simple inheritance and reading member of class instances are working now. </p><p> I also simplified my Test.php. The current test number is now tracked in a global variable. Before that change, the test number had to be passed in from the test script. </p> Bernhard 2009-06-24T13:35:34+00:00 journal My first PHP extension http://use.perl.org/~Bernhard/journal/39089?from=rss <p> PHP Extensions are usually written C and they usually export at least one constant, function, class, resource type or stream to the PHP userspace. So they are pretty much the same as XS-Modules in Perl 5. Extensive information about PHP extension can be found in Sara Golemons book 'Extending and Embedding PHP'. </p><p> The several hundred standard functions of PHP are implemented in terms of extensions. Pipp, <a href="http://pipp.org/">http://pipp.org/</a>, either needs to reimplement this massive count of functions, or support extensions natively. Being lazy, native support for extensions is the way to go. So let's see how to create a dummy PHP extension. The following is for Linux and is based on the tutorial <a href="http://devzone.zend.com/article/1021-Extension-Writing-Part-I-Introduction-to-PHP-and-Zend">http://devzone.zend.com/article/1021-Extension-Writing-Part-I-Introduction-to-P<nobr>H<wbr></nobr> P-and-Zend</a>. </p><p> The first step is to build PHP 5.3 with development support. The source can be checked out from a CVS repository. See <a href="http://www.php.net/anoncvs.php">http://www.php.net/anoncvs.php</a> for details and the password for anonymous CVS access.</p><blockquote><div><p> <tt>&nbsp; mkdir ~/first_php_extension<br>&nbsp; cd ~/first_php_extension<br>&nbsp; cvs -d<nobr> <wbr></nobr>:pserver:cvsread@cvs.php.net:/repository login<br>&nbsp; cvs -d<nobr> <wbr></nobr>:pserver:cvsread@cvs.php.net:/repository checkout -r PHP_5_3 php5</tt></p></div> </blockquote><p>Buildconf performs some checks and creates a configure script for the GNU autotools. 're2c' is the parser generator used by PHP 5.3. It is not build dependency, as the generated C-files are in the repository. There is also a message about 'autotools 2.13' being recommended, but I simply ignore that.</p><blockquote><div><p> <tt>&nbsp; cd ~/first_php_extension/php5<br>&nbsp;<nobr> <wbr></nobr>./buildconf</tt></p></div> </blockquote><p>For building extensions we need an installed PHP and it's associated helper scripts. Let's install our new PHP next to the source, so that the system PHP is left undisturbed.</p><blockquote><div><p> <tt>&nbsp; mkdir ~/first_php_extension/installed<br>&nbsp;<nobr> <wbr></nobr>./configure --prefix=/home/bernhard/first_php_extension/installed --enable-debug --enable-maintainer-zts --enable-embed<br>&nbsp; make test<br>&nbsp; make install<br>&nbsp; export PATH=~/first_php_extension/installed/bin:$PATH</tt></p></div> </blockquote><p>This should leave us with PHP 5.3 with debug support.</p><blockquote><div><p> <tt>&nbsp; bernhard@heist:~/first_php_extension/php5$ php --version<br>&nbsp; PHP 5.3.0RC3-dev (cli) (built: Jun&nbsp; 7 2009 12:36:41) (DEBUG)<br>&nbsp; Copyright (c) 1997-2009 The PHP Group<br>&nbsp; Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies</tt></p></div> </blockquote><p> The next step is to create a dummy extension without specific functionality. The helper script 'ext_skel' creates a stub in the directory 'pipp_sample'.</p><blockquote><div><p> <tt>&nbsp; cd ~/first_php_extension/php5/ext<br>&nbsp;<nobr> <wbr></nobr>./ext_skel --extname=pipp_sample</tt></p></div> </blockquote><p>For now I leave pipp_sample.c alone, but config.m4 needs to be edited. Instructions can be found in config.m4 itself, I ended up with uncommenting the lines 16, 18, 60.</p><blockquote><div><p> <tt>&nbsp; cd ~/first_php_extension/php5/ext/pipp_sample<br>&nbsp; vi config.m4</tt></p></div> </blockquote><p>The helper phpize takes info from the PHP installation and creates more files, including a configure script.</p><blockquote><div><p> <tt>&nbsp; phpize</tt></p></div> </blockquote><p>Now the dummy extension can be configured and compiled.</p><blockquote><div><p> <tt>&nbsp;<nobr> <wbr></nobr>./configure --enable-pipp_sample<br>&nbsp; make test</tt></p></div> </blockquote><p>A sanity test can be done with:</p><blockquote><div><p> <tt>&nbsp; php pipp_sample.php</tt></p></div> </blockquote><p>Now let's copy the generated shared lib for use by the installed PHP.</p><blockquote><div><p> <tt>&nbsp; make install</tt></p></div> </blockquote><p>The shared library could also be load by Pipp. Let's take a look at the function.</p><blockquote><div><p> <tt>&nbsp; bernhard@heist:~$ nm<nobr> <wbr></nobr>/home/bernhard/first_php_extension/installed/lib/php/extensions/debug-zts-20090<nobr>1<wbr></nobr> 15/pipp_sample.so | grep ' U '<br>&nbsp; U php_info_print_table_end<br>&nbsp; U php_info_print_table_header<br>&nbsp; U php_info_print_table_start<br>&nbsp; U spprintf<br>&nbsp; U zend_parse_parameters</tt></p></div> </blockquote><p>The undefined functions are provided by the PHP extension API. These are also the functions that need to be implemented for Pipp. </p> Bernhard 2009-06-07T11:45:24+00:00 journal Declaring lexicals within $sth-bind_columns() http://use.perl.org/~Bernhard/journal/38598?from=rss Lately I have taken on the maintainance of a legacy Perl 5 script. The script heavily uses the DBI function bind_columns() for retrieving data from a relational database. After some refaktoring I ended up with something like this:<blockquote><div><p> <tt>my $sth = $dbh-&gt;prepare(&lt;&lt;'END_SQL');<br>SELECT color, food, num_legs<br>&nbsp; FROM pet<br>END_SQL<br>my ( $food, $something_else, $color, $num_legs);<br>$sth-&gt;bind_columns( \$color, \$food, $num_legs );</tt></p></div> </blockquote><p>Not being entirely happy with I went one step further and got:</p><blockquote><div><p> <tt>my $sth = $dbh-&gt;prepare(&lt;&lt;'END_SQL');<br>SELECT color, food, num_legs<br>&nbsp; FROM pet<br>END_SQL<br>$sth-&gt;bind_columns( \( my ( $color, $food, $num_legs) ) ):<br>my ( $something_else );</tt></p></div> </blockquote><p>This style enforces some structure in the declaration. Is there a way to make this really nice? Installing a module is no option in this context.</p> Bernhard 2009-03-05T20:27:57+00:00 journal Pipp has left the nest and moved to github http://use.perl.org/~Bernhard/journal/38480?from=rss <p> Pipp, that is PHP on Parrot, has moved to github, <a href="http://github.com/bschmalhofer/pipp/">http://github.com/bschmalhofer/pipp/</a>. </p><p> I have not yet tested with an installed Parrot yet. So for now please check out Pipp in a Parrot source dir. See <a href="http://wiki.github.com/bschmalhofer/pipp">http://wiki.github.com/bschmalhofer/pipp</a> for details. </p><p> If you want to play with a cooler language than PHP, then take a look at <a href="https://trac.parrot.org/parrot/wiki/Languages">https://trac.parrot.org/parrot/wiki/Languages</a>. </p> Bernhard 2009-02-15T13:18:07+00:00 journal Moved Unlambda and Lazy K to github http://use.perl.org/~Bernhard/journal/38342?from=rss <p> <b>Unlambda</b>, <a href="http://www.madore.org/~david/programs/unlambda/">http://www.madore.org/~david/programs/unlambda/</a>, and <b>Lazy K</b>, <a href="http://esolangs.org/wiki/Lazy_K">http://esolangs.org/wiki/Lazy_K</a>, are two pure functional esoteric programming languages. Leo T&#246;tsch implemented them for Parrot. As language implementation are encouraged to leave the nest, I moved them over to Github, <a href="http://github.com/bschmalhofer">http://github.com/bschmalhofer</a>. </p><p> See <a href="https://trac.parrot.org/parrot/wiki/Languages">https://trac.parrot.org/parrot/wiki/Languages</a> for the current list of languages for Parrot. </p> Bernhard 2009-01-25T20:15:01+00:00 journal Parrot m4 has left the nest http://use.perl.org/~Bernhard/journal/38311?from=rss <p> Parrot m4 is an incomplete implementation of GNU m4 on top of parrot. As language implementations are encouraged to leave Parrot's svn, I have moved the code and the history over to <a href="http://github.com/bschmalhofer/m4/">http://github.com/bschmalhofer/m4/</a>. The source can easily be fetched by typing 'make co-m4' in the 'languages' directory of a Parrot working copy. </p><p> I am no longer working on m4, so anybody is welcome to clone it. However I think that porting GNU m4 to Perl 6 would be the more interesting task these days. </p><p> The mostly up-to-date list of Parrot HLLs is at <a href="https://trac.parrot.org/parrot/wiki/Languages">https://trac.parrot.org/parrot/wiki/Languages</a>. </p> Bernhard 2009-01-18T12:38:41+00:00 journal HQ9+ left the nest http://use.perl.org/~Bernhard/journal/38270?from=rss <p> HQ9+, <a href="http://www.esolangs.org/wiki/HQ9_Plus">http://www.esolangs.org/wiki/HQ9_Plus</a>, is a little language the makes a few things easy, and almost all other things impossible. </p><p> There is an implementation of HQ9+ for Parrot that is based on the Parrot Compiler Toolkit. For getting my feet wet with git, it moved the source code from Parrot's svn repository to <a href="http://github.com/bschmalhofer/hq9plus/tree/master">http://github.com/bschmalhofer/hq9plus/tree/master</a>. The migration went very smoothly and git made a good initial impression on me. The instructions on github.com were very helpful. Details on the migration are on <a href="https://trac.parrot.org/parrot/wiki/LeaveTheNest">https://trac.parrot.org/parrot/wiki/LeaveTheNest</a>. </p><p> In this migration I simply discarded the svn commit history. For moving other languages to git, it would be handy to have a complete and current git mirror of Parrot's svn repository. </p> Bernhard 2009-01-12T21:58:25+00:00 journal Closures for Pipp http://use.perl.org/~Bernhard/journal/38198?from=rss <p> In the last days I have been working on supporting closures for Pipp. Yes, you've read correctly. The next version of PHP will support real closures. See <a href="http://www.ibm.com/developerworks/opensource/library/os-php-5.3new2/index.html?ca=drs-tp5008">http://www.ibm.com/developerworks/opensource/library/os-php-5.3new2/index.html?<nobr>c<wbr></nobr> a=drs-tp5008</a> for a nice writeup. </p><p> Closures are connected with lexical variables, so I had I had to rethink the way I handle variables in Pipp. Initially I had the variables outside functions as package variables. Since this doesn't play well with closures, and as there are problems with included files, I changed those to lexical variables. This was the major part of the work. Thanks to Patrich Michaud for advising me where I should define the lexicals. </p><p> After switching to lexicals everywhere I followed my usual approach and tried to do the same as Rakudo does. This worked without hassle for a simple case.</p><blockquote><div><p> <tt>&lt;?php<br> <br>&nbsp; function gen_indentor ( ) {<br>&nbsp; &nbsp; &nbsp; $indention = '+';<br>&nbsp; &nbsp; &nbsp; $indentor = function ($line) use ($indention) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo $indention . $line . "\n";<br>&nbsp; &nbsp; &nbsp; };<br> <br>&nbsp; &nbsp; &nbsp; return $indentor;<br>&nbsp; }<br> <br>&nbsp; $sub_1 = gen_indentor();<br> <br>&nbsp; $sub_1('one plus');<br> <br>?&gt;</tt></p></div> </blockquote><p>correctly gives:</p><blockquote><div><p> <tt>+one plus</tt></p></div> </blockquote><p>But when I create a second closure I run into problems.</p><blockquote><div><p> <tt>&lt;?php<br> <br>&nbsp; function gen_indentor ($indention) {<br>&nbsp; &nbsp; &nbsp; $indentor = function ($line) use ($indention) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo $indention . $line . "\n";<br>&nbsp; &nbsp; &nbsp; };<br> <br>&nbsp; &nbsp; &nbsp; return $indentor;<br>&nbsp; }<br> <br>&nbsp; $sub_1 = gen_indentor('+');<br>&nbsp; $sub_4 = gen_indentor('++++');<br> <br>&nbsp; $sub_1('one plus');<br>&nbsp; $sub_2('four plusses');<br> <br>?&gt;</tt></p></div> </blockquote><p>incorrectly gives:</p><blockquote><div><p> <tt>++++one plus<br>++++four plusses</tt></p></div> </blockquote><p>Looks like I need to fiddle some more.</p> Bernhard 2009-01-01T16:57:22+00:00 journal Pipp is now more boring http://use.perl.org/~Bernhard/journal/38125?from=rss <p> Comparing different parsing and tree transformation techniques was for me a major reason for starting work on Pipp. Therefore Pipp had until now support for different frontends: </p><dl> <dt>Antlr 3</dt><dd>Parsing and tree transformation with Java-based Antlr 3</dd><dt>PHC</dt><dd>Take XML-output from phc and transform it with XSLT</dd><dt>PCT</dt><dd>Parrot Compiler Toolkit</dd></dl><p> Lately I found that I only worked on the PCT variant. So in order to keep it simple, especially for new contributors, I removed support for Antlr3 and PHC. </p><p> So, Pipp is now more boring, but other exciting things are coming. </p> Bernhard 2008-12-21T12:04:53+00:00 journal Rewriting Pipp tests in PHP http://use.perl.org/~Bernhard/journal/37961?from=rss <p>Pipp is Parrot's PHP and it has small test suite that lives alongside the code in the Parrot repository. Most of the test scripts are written in Perl 5 using the Parrot::Test modules. So usually I tell Pipp to run some PHP code and check whether the expected result is printed. This works fine but is not very exiting. </p><p> More exciting, for some definition of exciting, is to run PHP scripts and emit TAP with a testing lib implemented in PHP. So Pipp this needs </p><ol> <li>user defined functions with param passing</li><li> <b>global</b> for keeping track of the running test count</li><li>module loading</li></ol><p> Stealing from Rakudo I now got most of that. <b>global</b> is still missing, so currently I pass in the current test number and increment it outside the testing functions. </p><p> Over the next days I plan to port a selection of the easier scripts to PHP. Things like TODO, SKIP and regex matching have to wait for later. Takers welcome! </p> Bernhard 2008-11-27T20:36:12+00:00 journal Attended talk about Enterprise 2.0 http://use.perl.org/~Bernhard/journal/37876?from=rss <p> Wednesday night I attended a talk entitled "Enterprise 2.0 &#8211; Die Kunst, loszulassen". I didn't expect much of the talk, as I primarily went there for meeting people. But I was pleasently surprised, as the speaker Wilms Buhse did an excellent talk. He really made his point, that the lessons learned from social networks can be applied to enterprises. His examples were the experiences at CoreMedia and with http://www.dnadigital.de/. </p><p> The other thing I learned at the Forum is that Dresden is really a nice City. I just didn't find the sweet spots when I went there. </p> Bernhard 2008-11-14T12:35:57+00:00 journal Parrot 0.6.4 http://use.perl.org/~Bernhard/journal/36914?from=rss <p>On behalf of the Parrot team, I'm proud to announce Parrot 0.6.4 &quot;St. Vincent Amazon.&quot; <a href="http://parrotcode.org/">Parrot</a> is a virtual machine aimed at running dynamic languages.</p><p>Parrot 0.6.4 is available via <a href="http://search.cpan.org/dist/parrot">CPAN</a> (soon), or <a href="http://parrotcode.org/source.html">follow the download instructions</a>. For those who would like to develop on Parrot, or help develop Parrot itself, we recommend using <a href="http://subversion.tigris.org/">Subversion</a> on <a href="https://svn.perl.org/parrot/trunk/">our source code repository</a> to get the latest and best Parrot code.</p><p>Parrot 0.6.4 News:</p><blockquote><div><p> <tt>- Documentation<br>&nbsp; + removed a lot of old information from the FAQ<br>&nbsp; + improved function level documentation<br>- Configuration<br>&nbsp; + removed the configuration item 'has_gnu_m4'<br>&nbsp; + refactored ICU-detection<br>- Languages<br>&nbsp; + ChitChat<br>&nbsp; &nbsp; - improved the Smalltalk implementation<br>&nbsp; + Pipp<br>&nbsp; &nbsp; - renamed Plumhead to Pipp<br>&nbsp; &nbsp; - support for a lot of builtin functions.<br>&nbsp; &nbsp; - Pipp now uses PHP specific data types.<br>&nbsp; &nbsp; - converted from PCT with TGE to PCT with NQP actions<br>&nbsp; &nbsp; - improvements in the PCT variant by using optok parsing<br>&nbsp; &nbsp; - start of object support<br>&nbsp; + pir<br>&nbsp; &nbsp; - simple assignments work<br>&nbsp; + json<br>&nbsp; &nbsp; - added a PCT-based implementation of JSON parsing<br>&nbsp; + lolcode<br>&nbsp; &nbsp; - improved handling of symbols<br>&nbsp; &nbsp; - added support for block handling<br>&nbsp; &nbsp; - added support for globals<br>&nbsp; + Lua<br>&nbsp; &nbsp; - more tests<br>&nbsp; + Rakudo<br>&nbsp; &nbsp; - updated Range implementation<br>&nbsp; &nbsp; - added enums<br>&nbsp; &nbsp; - added generic type declarations (::T)<br>&nbsp; &nbsp; - added runtime mixing of roles with 'does' and 'but'<br>&nbsp; &nbsp; - added generic type declarations<br>&nbsp; &nbsp; - fixed handling of implicit lexicals ($_, $!, and $/)<br>&nbsp; &nbsp; - fixed implicit method calls on $_<br>&nbsp; &nbsp; - improved complex math builtins, added Complex<br>&nbsp; &nbsp; - moved many builtins to class Any<br>&nbsp; &nbsp; - declaration of lists of variables now work<br>&nbsp; &nbsp; - improved test infrastructure<br>&nbsp; &nbsp; - 910 additional passing spec tests since last release<br>&nbsp; &nbsp; - more convergence with STD.pm grammar<br>&nbsp; &nbsp; - added named 0-ary parsing and ops<br>- Compilers<br>&nbsp; + PCT:<br>&nbsp; &nbsp; - allowed subroutine and method names to be a PAST tree that produces the name<br>&nbsp; &nbsp; - Improved lexical handling<br>- Tools<br>&nbsp; + pbc_disassemble renamed from disassemble<br>- Implementation<br>&nbsp; + allowed<nobr> <wbr></nobr>.macro_const in PIR<br>&nbsp; + added the flag<nobr> <wbr></nobr>:lexid(...) for subroutines<br>&nbsp; + made multiple dispatch work for sub types<br>&nbsp; + fixed garbage collection bug related to the metadata attached to a PMC_EXT structure<br>&nbsp; + added a warning when using deprecated opcodes<br>&nbsp; + simplified the stacks implementation<br>&nbsp; + fixed C++ build<br>&nbsp; + improved closure and lexical support<br>&nbsp; + improved IMCC register allocator<br>&nbsp; + added cache for all runtime-constant strings, reducing memory usage<br>- Miscellaneous<br>&nbsp; + improved OpenGL/GLU/GLUT bindings<br>&nbsp; + added a standard profile for Perl::Critic coding standard testing<br>&nbsp; + added support for smoke testing with Smolder<br>&nbsp; + enabled use of Test::Harness 3.0 if available, but don't require it for 'make test'<br>&nbsp; + added the executable 'parrot_config' to query Parrot configuration</tt></p></div> </blockquote><p>Thanks to all our contributors for making this possible, and our sponsors for supporting this project. Our next release is 19 Aug 2008.</p><p>Enjoy!</p> Bernhard 2008-07-15T11:17:32+00:00 parrot Welcoming Pipp http://use.perl.org/~Bernhard/journal/36838?from=rss <p> The PHP on Parrot implementation used to be called Plumhead, after the Plum-Headed Parakeet. As this name is somewhat goofy, a new name was sought. Some more or less sane variants were discussed, <a href="http://www.perlfoundation.org/parrot/index.cgi?plumhead_renaming">http://www.perlfoundation.org/parrot/index.cgi?plumhead_renaming</a>. </p><p> And the winner is <b>Pipp</b>. </p><p> Thanks to Christoph Otto for getting this rolling. </p> Bernhard 2008-07-02T15:26:03+00:00 journal Eclectus now emits Not Quite Perl6 http://use.perl.org/~Bernhard/journal/36300?from=rss <p> Eclectus is a Scheme-compiler implemented in Scheme. The compilation target is a Parrot Abstract Syntax Tree, which is being run with the help of the Parrot Compiler Toolkit. </p><p> A sideline in Eclectus is the the problem how to tell PCT about the PAST generated in Scheme. Up to now I generated PIR that built up that data structure. This involved nasty dealings with unique ids for Parrot registers. </p><p> Generating NQP is much saner. The PAST is now set up with nested PAST::Node constructors. </p><p> Even nicer would be to create a YAML representation of PAST. But PCT doesn't support this yet. </p> Bernhard 2008-05-01T10:32:54+00:00 journal HQ9+ reimplemented with PCT http://use.perl.org/~Bernhard/journal/36033?from=rss <p> Klaas Jan's excellent "Parrot Compiler Tools" - Tutorial inspired me to go back and reimplement HQ9+ with PCT. The result is in <a href="http://svn.perl.org/viewvc/parrot/trunk/languages/hq9plus/">http://svn.perl.org/viewvc/parrot/trunk/languages/hq9plus/</a>. </p><p> As HQ9+ is not really a hard language, it all went fairly smooth. 'mk_language_shell.pl' created me a stub in 'languages/hq9plus'. Then I copied some reusable files from the old implementation in 'languages/HQ9plus'. This was fine under Linux, but caused pain for folks on case-insensitive file systems. Sorry, next time I try to think before committing! </p><p> For looking up snippets of PAST I used the old trick: write a snippet of Perl 6 and look at the PAST that Rakudo generates. </p><p> The last problem was whitespace handling. For that I only needed a simple change in the grammar. Replace all 'rule's by 'token's and sprinkle some '\s*'s. </p><p> The next thing on my agenda is for Plumhead and Eclectus. I want to switch from 'generate PIR that sets up PAST' to 'generate NQP that sets up PAST'. </p> Bernhard 2008-04-02T19:05:37+00:00 journal Parrot 0.6.0 "P&amp;P" released http://use.perl.org/~Bernhard/journal/35934?from=rss <p>On behalf of the Parrot team, I'm proud to announce Parrot 0.6.0 &quot;P&amp;P.&quot; <a href="http://parrotcode.org/">Parrot</a> is a virtual machine aimed at running dynamic languages. This release is a milestone release featuring the revamping of Parrot Magic Cookies.</p><p>Parrot 0.6.0 can be obtained via <a href="http://search.cpan.org/dist/parrot">CPAN</a> (soon), or <a href="http://parrotcode.org/source.html">follow the download instructions</a>. For those who would like to develop on Parrot, or help develop Parrot itself, we recommend using <a href="http://subversion.tigris.org/">Subversion</a> or <a href="http://svk.bestpractical.com/">SVK</a> on <a href="https://svn.perl.org/parrot/trunk/">our source code repository</a> to get the latest and best Parrot code.</p><p>Parrot 0.6.0 News:</p><blockquote><div><p> <tt>- Specification<br>&nbsp; + launched pdd18_security.pod<br>&nbsp; + updated pdd17_pmc.pod<br>&nbsp; + launching draft of pdd28_character_sets.pod<br>- Documentation<br>&nbsp; + cleanup of IMCC documentation<br>- Configuration<br>&nbsp; + add step auto::gettext<br>&nbsp; + add step auto::crypto<br>- Compilers<br>&nbsp; + PCT:<br>&nbsp; &nbsp; . Fix '-e' option<br>&nbsp; &nbsp; . Phase out P6Regex in favor of Perl6Regex<br>&nbsp; + IMCC:<br>&nbsp; &nbsp; '.local Array my_arr' is illegal now<br>- Languages<br>&nbsp; + C99: reimplementation with PCT<br>&nbsp; + lolcode:<br>&nbsp; &nbsp; . various updates<br>&nbsp; &nbsp; . add support for functions with params<br>&nbsp; &nbsp; . add math functions<br>&nbsp; + Rakudo:<br>&nbsp; &nbsp; . support for 'say'<br>&nbsp; &nbsp; . first cut at smart matching<br>&nbsp; &nbsp; . indirect method calls<br>&nbsp; &nbsp; . support for Pairs<br>&nbsp; &nbsp; . added methods 'grep' and 'first'<br>&nbsp; &nbsp; . implement auto{increment,decrement}<br>&nbsp; &nbsp; . initial implementation of 'perl6doc'<br>&nbsp; + Lua:<br>&nbsp; &nbsp; . various updates<br>&nbsp; &nbsp; . add base64 library<br>&nbsp; + Cardinal: basic support for functions with parameters<br>&nbsp; + Pheme: various updates<br>&nbsp; + Ecmascript: various updates<br>&nbsp; + Tcl: now targeting tcl 8.5.1, no more expected failures in test suite.<br>&nbsp; &nbsp; (No, this doesn't mean everything's implemented. =-)<br>&nbsp; + Eclectus: various updates<br>&nbsp; + WMLScript: various updates<br>- Implementation<br>&nbsp; + PDD17 (PMCs)<br>&nbsp; + Add library YAML::Dumper<br>&nbsp; + Add the MD2, MD4, MD5, RIPEMD160, SHA &amp; SHA1 PMC, as a wrapper<br>&nbsp; &nbsp; &nbsp;around libcrypto<br>- Miscellaneous<br>&nbsp; + various bugfixes, code cleanups and coding standard fixes<br>&nbsp; + consting<br>&nbsp; + remove external Perl 5 modules from the Parrot distribution</tt></p></div> </blockquote><p>Thanks to all our contributors for making this possible, and our sponsors for supporting this project.</p><p>Enjoy!</p> Bernhard 2008-03-18T21:19:10+00:00 parrot Techtip of the week http://use.perl.org/~Bernhard/journal/35755?from=rss When being shocked that your notebook is kaputt, as it apparently gets no power, please make sure that you are using the correct power supply. There are plugs with a slightly wider inner diameter. Bernhard 2008-02-25T20:09:55+00:00 journal Parrot Abstract Syntax Tree in Scheme-XML http://use.perl.org/~Bernhard/journal/35308?from=rss <p> As I'm hacking away at Eclectus, Scheme on Parrot in Scheme, I'm starting to pick some Scheme knowledge. So before implementing new features I employed my new wisdom and did some refactoring on my Scheme code. </p><p> The most nasty thing in compiler.scm was the generation of PIR while traversing the to-be-compiled s-expression. I decided to use XML Infoset as an intermediate representation, as I already have an XSLT sheet for generating a PIR representation of PAST from an XML representation of PAST. The nice thing is that the XML infoset can also be represented as a Scheme s-expression, that is SXML. The Scheme librarx SSAX-SXML can turn SXML into XML and perform XSLT operations. </p><p> For an example let's look at the Scheme form:</p><blockquote><div><p> (fx+ (fx+ -10 11) (fx+ (fx+ 4 3) (fx+ 3 3)))</p></div> </blockquote><p> In Perl 5 this could be expressed:</p><blockquote><div><p> say ( (-11 10) + ( (4 + 3) + (3 + 3)));</p></div> </blockquote><p> Represented as SXML this becomes: <code> (|PAST::Stmts| (|PAST::Op| (|@| (pasttype "call") (name "say")) (|PAST::Op| (|@| (pirop "n_add")) (|PAST::Op| (|@| (pirop "n_add")) (|PAST::Val| (|@| (value -10) (returns "EclectusFixnum"))) (|PAST::Val| (|@| (value 11) (returns "EclectusFixnum")))) (|PAST::Op| (|@| (pirop "n_add")) (|PAST::Op| (|@| (pirop "n_add")) (|PAST::Val| (|@| (value 4) (returns "EclectusFixnum"))) (|PAST::Val| (|@| (value 3) (returns "EclectusFixnum")))) (|PAST::Op| (|@| (pirop "n_add")) (|PAST::Val| (|@| (value 3) (returns "EclectusFixnum"))) (|PAST::Val| (|@| (value 3) (returns "EclectusFixnum"))))))))) </code></p> Bernhard 2008-01-06T18:30:34+00:00 journal Plumhead and Eclectus http://use.perl.org/~Bernhard/journal/35069?from=rss <p> I'm inching forward with Plumhead, PHP on Parrot, and Eclectus, Scheme on Parrot. </p><p> Both have been converted to use the shiny new Parrot Compiler Toolkit. I don't use NQP yet, but being able to use Perl6 for compiler and library implementation is sooo sweet. Kudos to Patrick Michaud. </p><p> On the Plumhead side, Jeff Horwitz did some brave hacking and added Plumhead to mod_parrot. See <a href="http://www.smashing.org/jeff/node/24">http://www.smashing.org/jeff/node/24</a> </p> Bernhard 2007-12-09T20:33:00+00:00 journal Introducing Eclectus http://use.perl.org/~Bernhard/journal/34915?from=rss <p> When working on 'languages/scheme' in the Parrot repository I got estranged with using Perl5 for implementing Scheme on Parrot. It sure does the job, but I want to learn about Lisp, not about Arrays of Arrays in Perl 5. </p><p> I came across <i>An Incremental Approach to Compiler Construction</i> at <a href="http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf">http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf</a>. This is a Scheme to x86 assembly compiler, implemented in Scheme. The cute thing is that the compiler construction is done in small steps. Every step constitutes a working compiler for a larger subset of Scheme. So I stared to work on Eclectus, a bootrapping Scheme to PBC compiler. </p><p> For pictures ses <a href="http://en.wikipedia.org/wiki/Eclectus">http://en.wikipedia.org/wiki/Eclectus</a> </p> Bernhard 2007-11-17T17:14:37+00:00 journal Teaching myself Scheme http://use.perl.org/~Bernhard/journal/34803?from=rss <p> In the last weeks I have been neglecting Plumhead, that is PHP on Parrot. Instead I have been concentrating on learning about Common Lisp and Scheme. Currently I'm working my way through a nice Scheme tutorial, <cite>Teach Yourself Scheme in Fixnum Days</cite> <a href="http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme.html">http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme.html</a>. I try to make the tutorial examples work in 'languages/scheme', a Scheme on Parrot implementation from Jeff Goff. </p><p> I also got me a copy of <cite>Lisp in small pieces</cite>. But I found that it's better to know a little bit of Scheme, before starting to delve into that. </p> Bernhard 2007-10-31T19:09:14+00:00 journal Seen on reddit: What large websites are running on http://use.perl.org/~Bernhard/journal/34589?from=rss Seen on programming.reddit.com:<br> <i>What nine of the world&#8217;s largest websites are running on</i> <a href="http://royal.pingdom.com/?p=173">http://royal.pingdom.com/?p=173</a>.<br> Perl has a strong showing. However the selection of sites has been debated. <a href="http://programming.reddit.com/info/2vbag/comments">http://programming.reddit.com/info/2vbag/comments</a> <br> The data for the table was scraped from <a href="http://highscalability.com/">http://highscalability.com/</a> Bernhard 2007-10-02T08:25:08+00:00 journal Bitflip error http://use.perl.org/~Bernhard/journal/33593?from=rss <p> On Friday a colleague @work asked me about an error in a webapplication. There was a Perl syntax error in Sys::Hostname. As I saw no reason that anybody should mess with with Sys::Hostname, I checked the time Hostname.pm was last changed. Confusingly the last change was in 2004, apparently this was the time the server was set up. A diff with another Perl 5.8.0 installation showed a single bit change. The first space, 0x20, of Hostname.pm line 104 has turned into into a '(', 0x28. The only explanation I can imagine is that a bit has flipped in file cache. </p><p> <em>Strange.</em> </p> Bernhard 2007-06-24T20:22:00+00:00 journal Choosing a license for Plumhead http://use.perl.org/~Bernhard/journal/32949?from=rss <p> I have been thinking on how to proceed with Plumhead, that is PHP on Parrot. The problem is that I have neither the ability nor the inclining to write a PHP grammar from scratch. So a template is needed. This brings up the question of licensing. </p><p> Johnlim's blog <a href="http://phplens.com/phpeverywhere/?q=node/view/223">http://phplens.com/phpeverywhere/?q=node/view/223</a> got me jumpstarted on which PHP implementations are out there. I have put my finding into the Parrot Wiki, <a href="http://rakudo.org/parrot/index.cgi?plumhead">http://rakudo.org/parrot/index.cgi?plumhead</a>. The projects that look most interesting to me are phc, PHP4Mono and Roadsend. The PHP4Mono and the Roadsend grammars seem to be written from scratch. Both projects are GPL licensed. The phc grammar is derived from the PHP 5.2 grammar. </p><p> PHP 5.2 is licensed under the PHP license, while parts are under the Zend license. Both licenses are BSD-like, which is quite acceptable to me. </p><p> So the plan of the day is to derive the Plumhead grammars from the PHP 5.2 grammar. I'm not sure whether that means that I need to put the whole of Plumhead under BSD license, or whether I can stick with Artistic+GPL. </p> Bernhard 2007-04-09T20:19:16+00:00 journal Triboluminescence http://use.perl.org/~Bernhard/journal/32415?from=rss <p> Tonight I was opening a sealed envolope in dim light. When opening the envelope I noticed blueish flashes of light where the adhesive was pulling apart. Subconciously I probably was looking out for that, as I already had noticed the phemenomen some years ago. </p><p> Googling told me that this effect in called Triboluminescence <a href="http://en.wikipedia.org/wiki/Triboluminescence">http://en.wikipedia.org/wiki/Triboluminescence</a>, which means 'light from rubbing'. Apparently this is one of the messier phemenomens. At least three different mechanisms were suggested. Breaking of polymers, squashing of crystals and surface excitations. During my study of physics I never came accross it. The closest thing was the piezoelectric effect, which has a lot of technical applications. </p><p> If I don't forget about it, I'll get me some sugar cubes and crush them in the dark. </p><p> PS: Is there a something like a TinyMCE for use.perl ? Typing all that markup is tiring. </p> Bernhard 2007-02-15T21:44:02+00:00 journal More Plumheads http://use.perl.org/~Bernhard/journal/32169?from=rss <p> Lately I have expanded the scope of <b>P</b>lum<b>H</b>eaded <b>P</b>arakeet. The current plan is to have a side-by-side comparison of differend parsing and transformation techniques. These techniques are: </p><dl> <dt>PHC</dt> <dd>Take XML output of phc, <a href="http://phpcompiler.org/">http://phpcompiler.org/</a>, and transform it with XSLT.</dd><dt>ANTLR3</dt><dd>Write parser and treegrammar in ANTLR3, <a href="http://www.antlr.org/wiki/display/ANTLR3/">http://www.antlr.org/wiki/display/ANTLR3/</a>, with Java backend</dd><dt>Partridge</dt><dd>Use the Parrot compiler tools for parsing and transformation</dd></dl><p> The transformation target is in all three PAST-pm, an abstract syntax tree that can be trasformed into Parrot bytecode. </p><p> See also <a href="http://rakudo.org/parrot/index.cgi?plumhead">http://rakudo.org/parrot/index.cgi?plumhead</a> </p> Bernhard 2007-01-16T23:03:06+00:00 journal MIME::Base64 http://use.perl.org/~Bernhard/journal/31304?from=rss <p>After starting on Plumhead, aka <strong>P</strong>lum<strong>H</strong>eaded <strong>P</strong>arakeet, I stumbled on base64 encoded strings embedded in the XML emitted by phc <a href="http://phpcompiler.org/">http://phpcompiler.org/</a>.</p><p>The plan is to create Parrot Intermediate Representation from XML. So I became sidetracked into making a MIME::Base64 module for PIR. As usual it took longer than expected, even though I found a nice german tutorial, <a href="http://aktuell.de.selfhtml.org/artikel/javascript/utf8b64/base64.htm">http://aktuell.de.selfhtml.org/artikel/javascript/utf8b64/base64.htm</a><br>So an incomplete implementation is now at <a href="http://svn.perl.org/viewcvs/parrot/trunk/runtime/parrot/library/MIME/Base64.pir">http://svn.perl.org/viewcvs/parrot/trunk/runtime/parrot/library/MIME/Base64.pir</a><nobr>.<wbr></nobr> <br>The tests I stole from the Perl5 module MIME::Base64. Thanks to Will Coleda for compilers/json, which helps in setting up the test cases.</p> Bernhard 2006-10-12T21:42:46+00:00 journal Plum-headed Parakeet http://use.perl.org/~Bernhard/journal/30941?from=rss <p>Mark Overmeer passed on one of the take home messages from YAPC::Europe in Birmingham. In a lightening talk about XML::Compile, <a href="http://search.cpan.org/~markov/XML-Compile/">http://search.cpan.org/~markov/XML-Compile/</a>, he said something like: <cite>Never mind the XML, it's just syntax.</cite> The day before, Allison Randall had talked about the Parrot compiler tools and mentioned how XSLT had influenced the design of TGE. So I wondered whether <cite>Never mind the XSLT, it's just syntax.</cite> applies as well. </p><p> The XSLT project I came up with, is to take the XML output of phc, <a href="http://phpcompiler.org/">http://phpcompiler.org/</a> and transform it to something Parrot can understand. phc parses PHP, so this should become an implementation of PHP on Parrot. </p><p> As a projectname, <a href="http://svn.perl.org/viewcvs/parrot/trunk/languages/plumhead/">http://svn.perl.org/viewcvs/parrot/trunk/languages/plumhead/</a>, I chose 'Plumhead', which is short for <b>P</b>lum-<b>h</b>eaded <b>P</b>arakeet, <a href="http://en.wikipedia.org/wiki/Plum-headed_parakeet">http://en.wikipedia.org/wiki/Plum-headed_parakeet</a>. The description on Wikipedia is neat too: <cite>Plum-headed Parakeet is a gregarious and noisy species with range of raucous calls.</cite> </p> Bernhard 2006-09-09T21:24:56+00:00 journal May 2006 Munich Perl Monger meeting http://use.perl.org/~Bernhard/journal/29636?from=rss <p> Last night the Munich Perl Mongers celebrated the second installment of the bimonthly meeting. Harald J&#246;rg, the MPM fearless leader, suggested a 'Man Fat, a chinese restaurant in Schwabing as the stomping ground. The food was tasty and the wheatbeer was most welcome after the bike ride from $work at the other end of town. </p><p> Besides 7 regulars, two new faces showed up: another J&#246;rg, of Perl golf fame, and Susanne Ruppel. Susanne got the rocks rolling by suggesting to bid for the German Perl Workshop 2007. As the enthusiasm is there, it was decided to go for it! In 2002, when we hosted the YAPC::EU, only Norbert Gr&#252;ner really knew what we were getting into. This time we have no excuses. </p> Bernhard 2006-05-18T21:50:57+00:00 journal Munich Perl Monger meeting http://use.perl.org/~Bernhard/journal/29016?from=rss <p> In a radical breach of tradition, the Munich Perl Mongers decided to have regular bimonthly meetings. In order to limit the culture shock, the location will remain dynamic and will be chosen in feverish indecision. </p><p> So yesterday evening was the first regular meeting. Five Mongers showed, including a new face, Gertraud. Harald J&#246;rg has a writeup in German, <a href="http://munich.pm.org/2006-03-15.html">http://munich.pm.org/2006-03-15.html</a>. Topics ranged from using 'ed' on appliances to the job prospects of assembler programmers for BS2000. </p><p> The MPM schedule is the third wednesday of uneven months. When in doubt consult the perlgolf entries in <a href="http://munich.pm.org/perlgolf.html">http://munich.pm.org/perlgolf.html</a>. </p><p> On the Parrot side, I hope to teach ANTLR 3 more about bc. And coming saturday I plan to attend the 'Linux Info Tag' in Augsburg, enjoying Ingo Blechschmidt's talk 'Perl6 genau jetzt'. </p> Bernhard 2006-03-16T19:51:37+00:00 journal