[MarpaX::Regex] empty capturing groups

15 views
Skip to first unread message

Ruslan Shvedov

unread,
Feb 5, 2015, 8:02:16 AM2/5/15
to marpa-...@googlegroups.com
MarpaX::Regex saw some progress recently: as an early preview, here is the BNFied version of floating point regexp from perlretut (parses, but ). Symbols, e.g. <start of line> ::= ^, can be defined for (arguably more) readability.

Perhaps I'm just "holy overanalyzing, Batman", but I have a question about empty capturing groups: how to implement them 

as is, e.g.

s ::= 'house' ( 'cat' |)
s ::= 'house' ( 'cat' ( 's' |) |)

or allow them only via an empty rule, e.g.

s ::= 'house' ( 'cat' | empty )
s ::= 'house' ( 'cat' ( 's' | empty ) | empty )
empty ::= # empty rule

I'm afraid the right decision is support both, but would appreciate other opinions. And any early feedback too. :)

As a general (perhaps incomplete) observation, POSIX [1] and Perl6 [2] seem to forbid empty capturing groups, while PCRE, ECMAscript, Java and .Net allow them and according to a book [2] such groups can be used intentionally, even if for the purposes MarpaX::Regex aims to serve.

[1] the empty  group `()' in `a()b' is invalid
https://docs.freebsd.org/info/regex/regex.info.POSIX_Regular_Expression_Compiling.html


rns

unread,
Feb 5, 2015, 8:06:25 AM2/5/15
to marpa-...@googlegroups.com
s/(parses, but )./(parses, but doesn't matches).

Jeffrey Kegler

unread,
Feb 7, 2015, 12:01:39 AM2/7/15
to Marpa Parser Mailing LIst
I have no opinion on the question posed, but I am very much looking forward to this module.

--
You received this message because you are subscribed to the Google Groups "marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email to marpa-parser...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages