develooper Front page | perl.perl6.language | Postings from June 2006

About default options ':ratchet' and ':sigspace' on rules

Thread Next
Shu-chun Weng
June 2, 2006 02:44
About default options ':ratchet' and ':sigspace' on rules
Message ID:

 (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,,
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:

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

      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!

Shu-Chun Weng

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About