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

Reply via email to