Profilo di agentzhHuman & MachineFotoBlogElenchiAltro ![]() | Guida |
|
24 ottobre A graphical tracer for Perl 6 regexes based on PCRTracing parse failures by hand while developing a compiler can be really a nightmare, since the real problem can appear everywhere -- the grammar definition, the input string being matched, or even the regex engine itself.
So I've implemented a graphical tracer for Perl 6 regexes atop PCR (Pugs::Compiler::Rule). You can find some small online demos here:
To generate the HTML pages (say, the first demo) yourself, simply check out the Pugs repository , ``cd'' into perl5/Pugs-Compiler-Rule, and enter the following commands: $ perl util/compile_p6grammar.pl -D examples/digits.grammar > Digits.pm The tracer interface still needs love and at the moment I'm adding cooler features like ``random jump'', ``stepping in a specified pace'', and ``stepping back''. If you like to help, just join #perl6 and get a Pugs commit bit ;) I think this tool should be very useful for both regex engine developers and compiler writers, especially when parsing fails in an unexpected way. And it can also be beneficial to Perl 6 beginners who want to learn the shiny new regex syntax and complicated matching behaviors by just ``stepping through'' the real parsing process. moritz++ said on #perl6 that he would build a CGI script to make my demos above ``alive'' when he had the tuits; let's just wait and see ;) It should be warned that the regex syntax supported by the current PCR implementation is already a little out-of-date regarding the lastest Synopsis 5 . (Thanks TimToady++ for tweaking the regex syntax during the meantime ;)) I'll try to port KindaPerl6 's perl5rx backend over to PCR later. Hey, it'll be nicer to have KindaPerl6, PGE , or even the Perl 5 regex engine to work with my tracer as well :) Stay tuned! -agentzh P.S. This entry was originally posted as http://pugs.blogs.com/pugs/2007/10/a-graphical-tra.html 18 ottobre Jifty::I18N meets XUL developmentI've just ported Jifty::I18N and something in Jifty::Script::Po over to my XUL application framework, XUL::App. And my Perl-based Firefox extension, SearchAll (
https://addons.mozilla.org/en-US/firefox/addon/5712 ), is already using it. Because XUL::App is also using Template::Delcare as its templating language, the port is rather straightforward. For example, one of SearchAll's view looks like this: http://svn.openfoundry.org/searchall/trunk/lib/SearchAll/View/Main.pm Note that I'm also using _("...") calls in the view ;) Extracting these string literals is a single command in XUL::App (just like Jifty): bin/xulapp po --lang us_en It will scan all the .pm files and generate po/us_en.po for you. For example, here is the Po file directory for my SearchAll extension: http://svn.openfoundry.org/searchall/trunk/po/ Unlike Jifty, XUL::App tries to behave more like a compiler than a runtime. So these po files won't appear in the final XPI bundle. XUL::App will carefully convert these .po files to the corresponding DTD entities required by XUL's own L10N mechanism. So still, there's *0* Perl in the "runtime". Testing I10N within Firefox is straightforward as well: bin/xulapp overlay --profile dev --lang zh_cn Or just testing a particular .xul file in Firefox using a specified profile named "dev": bin/xulapp searchall.xul --profile dev --lang zh_cn See http://svn.openfoundry.org/searchall/trunk/README for more "xulapp" usage in the SearchAll project if you're interested :) In XUL::App, I've been trying very hard to follow Jifty's best practices. Jifty is so great that every fundamental component has been keeping me very excited ;) Once XUL::App gets matured enough, I'll push it onto CPAN. If you like to help, please let me know ;) Thanks! 13 ottobre SearchAll 0.1.8 released on AMO!On behalf of the Yahoo! China EEEE hacking team, I'm pleased to announce the 0.1.8 release of SearchAll on addons.mozilla.org
(AMO), with the highlights of *many* more default search engines (including Taobao, eBay, Amozon, Answers.com, and image search engines!) and much improved performance, reliability, and user experience.
If you already have an older version of SearchAll installed in your Firefox, the new version should shortly arrive at your side automatically. If not, please check the updates explicitly in your Firefox's extension manager (Tools menu => Addons menu-item). If you have not yet got SearchAll before, you can install it directly from SearchAll's en-US homepage on AMO: https://addons.mozilla.org/en-US/firefox/addon/5712 Or its zh-CN homepage here if you prefer: I really appreciate the tireless project coordination, bug reports, and feature requests from my $boss, laser++ (何伟平). And I'm also grateful to our professional UI engineer, yedan++ (叶丹). Personally I like her logo for SearchAll so much ;) Special thanks go to our PE, jianingy++ (杨家宁), for his all-encompassing technical support. Without his support, technically speaking, 0.1.8 won't be released so fast. At last but not least, I appreciate all the help from other 4e colleagues that I haven't mentioned here, as well as the cool boy, yuanyin++ (何远银), from the content team . Thank you all! Here's the detailed change log for version 0.1.8 (compared to the previous 0.1.5 release): * Added the folowing new US search engines to the default URI list: www.amazon.com www.ask.com addons.mozilla.org/search * Added the following new Chinese search engines to the default URI list: taobao.com so.163.com www.sogou.com * Added the following new image search engines to the default URI list: image.cn.yahoo.com images.google.com images.google.cn image.baidu.com * Fixed yisou.com so that SearchAll can work with it in 'page mode'. * Fixed the timer for next/prev page button actions. * Fixed the hostname hash bug. Now 2 identical SE's (such as 2 yahoo.cn) can work at the same time. * Now we use '<<Prev' and 'Next>>' labels instead of arrow icons in the navigation buttons. * Set clickSelectsAll for the toolbar's textbox (just like the Google toolbar :)). * Fixed a bug for Mac Firefox. Unlike linux and win32, Mac centers the tabs which breaks the UI. thanks cnhackTNT++ for reporting this. * Refreshing the .xul page in 'page mode' now (mostly) works. * Fixed a bug that baidu.com will show loading animation forever when there's no results at all. * Hides 'please enter your queries above' as early as possilbe in 'page mode'. * Removed several setTimeout calls in the JS code so as to make things a bit faster. * Cached the html so that next/prev page switching is now much more smoothly. * Use WPL.STATE_IS_NETWORK instead of STATE_IS_WINDOW to eliminate bogus progressing actions. * Improved and optimzied the pattern mining algorithm and implementation. * Made the auto-form-submitting code much smarter. Enjoy! -agentzh P.S. As a side note, 0.1.9 will get its way into AMO pretty soon as well ;) Stay tuned! 03 ottobre Fwd: Mozilla Add-ons: SearchAll NominationYay! My SearchAll addon has been made public on addons.mozilla.org !!! I've put the mail from Mozilla Add-ons below. I don't quite understand what he/she meant by "A shame it works only with censored search engines though." Actually SearchAll has been working with (almost) arbitrary search engines for long ;) ---------- Forwarded message ---------- From: Mozilla Add-ons <nobody@mozilla.org> Date: Oct 2, 2007 11:56 PM Subject: Mozilla Add-ons: SearchAll Nomination Congratulations! Your nominated add-on, SearchAll, has been reviewed by a Mozilla Add-ons editor who approved your add-on to be public. Your most recent version ( 0.1.4) has also been made public. You can view your public add-on now at: http://addons.mozilla.org/addon/5712 Review Information: Reviewer: Oliver Saier Comments: Pushing to public per my tests and the good reviews. A shame it works only with censored search engines though. Thanks. If you have questions about this review, please e-mail amo-editors@mozilla.org or join #addons on irc.mozilla.org. Mozilla Add-ons http://addons.mozilla.org |
|
|