Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion About default options ':ratchet' and ':sigspace' on rules

View parsed - Show only message text

Newsgroups: perl.perl6.language
Path: g2news2.google.com!news3.google.com!newsfeed.stanford.edu!nntp.perl.org
Return-Path: <scw...@gmail.com>
Mailing-List: contact perl6-language-h...@perl.org; run by ezmlm
Delivered-To: mailing list perl6-langu...@perl.org
Delivered-To: moderator for perl6-langu...@perl.org
Received: (qmail 7589 invoked from network); 2 Jun 2006 06:18:07 -0000
Received: from x1a.develooper.com (HELO x1.develooper.com) (216.52.237.111)
  by lists.develooper.com with SMTP; 2 Jun 2006 06:18:07 -0000
Received: (qmail 4024 invoked by uid 225); 2 Jun 2006 06:18:07 -0000
Delivered-To: perl6-langu...@perl.org
Received: (qmail 4019 invoked by alias); 2 Jun 2006 06:18:06 -0000
X-Spam-Status: No, hits=-2.6 required=8.0
	tests=BAYES_00,DK_SIGNED,DK_VERIFIED,SPF_PASS
X-Spam-Check-By: la.mx.develooper.com
Received-SPF: pass (x1.develooper.com: domain of scw...@gmail.com designates 66.249.82.195 as permitted sender)
Received: from wx-out-0102.google.com (HELO wx-out-0102.google.com) (66.249.82.195)
    by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Thu, 01 Jun 2006 23:17:31 -0700
Received: by wx-out-0102.google.com with SMTP id t13so332465wxc
        for <perl6-langu...@perl.org>; Thu, 01 Jun 2006 23:17:26 -0700 (PDT)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
        s=beta; d=gmail.com;
        h=received:message-id:date:from:sender:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition:x-google-sender-auth;
        b=X00BzSa2tVx931KSr1TMLXQl3iT0ebsQ05dCCjSVtaAvDJbA7cfoCSkhl55RzlIpmrvoTCMsnAcm8km8sTG3VH8mVBrcuGvx6YwbxrJL/sqHS4joM6UOsy45V+yGvdYpQK+cVDp1M2d4yGCN9xBwbfmIC60JlfXphVpP+MBg27g=
Received: by 10.70.6.1 with SMTP id 1mr2058377wxf;
        Thu, 01 Jun 2006 23:17:26 -0700 (PDT)
Received: by 10.70.45.5 with HTTP; Thu, 1 Jun 2006 23:17:25 -0700 (PDT)
Message-ID: <1bbab4880606012317v5a0a2f4fs8319da75c643e1c4@mail.gmail.com>
Date: Fri, 2 Jun 2006 14:17:25 +0800
Sender: scw...@gmail.com
To: perl6-langu...@perl.org
Subject: About default options ':ratchet' and ':sigspace' on rules
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Approved: n...@nntp.perl.org
From: s...@csie.org (Shu-chun Weng)

Hello,

 (used to post on google group but found it does not deliver)

I'm implementing "MiniPerl6" in pugs which is the first step of
writing perl 6 parser in perl 6.  In module Pugs::Grammar::MiniPerl6,
 http://svn.openfoundry.org/pugs/misc/pX/Common/Pugs-Grammar-MiniPerl6,
I use another perl 6 grammar to describe it.  It works well several
days before when the parsing engine written in perl 5 did not
implemented :ratchet and :sigspace flags.

The grammar file can be found here:
http//svn.openfoundry.org/pugs/misc/pX/Common/Pugs-Grammar-MiniPerl6/lib/Pugs/Grammar/MiniPerl6.grammar

The "token" part is fine, but the "rule" part is extremely ugly.  I can
not add additional spaces to format it.

I'd like to suggest two changes to make it easier to write rules:

  1. Spaces at beginning and end of rule blocks should be ignored
     since space before and after current rule are most likely be
     defined in rules using current one.
  1a. I'm not sure if it's "clear" to define as this, but the spaces
      around the rule-level alternative could also be ignored.  For
      instance, look at the rule FunctionAppExpr defined in
      MiniPerl6 grammar file.

        rule FunctionAppExpr
{<Variable>|<Constants>|<ArrayRef>|<FunctionName>[<?ws>?<'('><?ws>?<Parameters><')'>]?}

      I could not even put a new line in it.  In the file, since there
      are production rules, I put the brases on strange positions
      to format it better.

  2. I am not sure the default rule of <ws>, I couldn't found it in
     S05.  Currently the engine use :P5/\s+/ but I would like it to
     be :P/\s*/ when it's before or after non-words and remains
     the same (\s+) otherwise.

I do not subscribe this group but subscribe daily digest, so it's OK to
reply on the list.  Suggestions welcome!

Cheers,
Shu-Chun Weng

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google