1. 26

Rosie is a regex replacement based on parsing expression grammars

  1.  

  2. 7

    I tried hard to find examples and gave up

    1. 6
      1. 3

        Me too. Pity that many people will come up to the web site, click on Examples, which leads them to a mostly empty page with some links, click there and find no overview and give up (at least I did). Would be great to have some examples and/or comparisons with other regexes. Sigh…

        1. 4

          This seems like a great idea.

          Then I visited https://gitlab.com/rosie-community/clients … no Javascript lib, no Ruby lib. Call me again when one of those gets built…

          1. 3

            There was also a Strange Loop talk about this in 2018.

            It is (was?) built on top of lpeg, but trying to address some usability issues with PEGs.

            1. 3

              I like the idea of the unit testing feature, as can be seen in the time.rpl example:

              hour =  { [01] [0-9] } /
                      { "2"  [0-3] } 
              -- test hour accepts "00", "15", "20", "23"
              -- test hour rejects "", "0", "5", "24", "99"
              
              …
              
              rfc2822_time = { hour ":" minute {":" second}? }
              -- test rfc2822_time accepts "00:00:00", "12:00", "23:59:60", "16:08:33", "01:55", 
              -- test rfc2822_time rejects "", "24:10:10", "33:40", "17:28:33.0", "00:00:00.00000", "10:30:02.125"
              

              I’m not convinced that Rosie Pattern Language is worth the complexity it adds compared to using a PEG parsing library for my preferred language. But I don’t know of any language-specific parsing library that makes tests-as-documentation as easy to write as the above. It makes me wonder how to port that feature to those other libraries.

              1. 3

                Paging @andyc :)

                1. 4

                  FAQ here :)

                  https://github.com/oilshell/oil/blob/master/doc/regex-manual.md#how-do-eggexes-compare-with-perl-6-regexes-and-the-rosie-pattern-language

                  Essentially Rosie is based on PEGs, and Oil won’t have any support for PEGs natively, only regexes. However it’s a low enough level language that it wouldn’t be crazy to write PEGs on top, just like you can write PEGs in Python.

                  BTW the author of Rosie has been very supportive of Oil, which I appreciate. I think I mentioned to her a vague plan for eggex maybe a year ago.