From 4efc7d00b5927c4d1a7b657b3984008ee35e970f Mon Sep 17 00:00:00 2001 From: Joelle Maslak Date: Sat, 12 Oct 2019 16:08:15 -0600 Subject: Joelle's solution to 29.1 in Perl 6 --- challenge-029/joelle-maslak/perl6/ch-1.p6 | 73 +++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100755 challenge-029/joelle-maslak/perl6/ch-1.p6 diff --git a/challenge-029/joelle-maslak/perl6/ch-1.p6 b/challenge-029/joelle-maslak/perl6/ch-1.p6 new file mode 100755 index 0000000000..0234c8deb9 --- /dev/null +++ b/challenge-029/joelle-maslak/perl6/ch-1.p6 @@ -0,0 +1,73 @@ +#!/usr/bin/env perl6 +use v6; + +# This handles the following: +# +# a{1,2} +# a{1,2{3,4}}{5,6}b +# +# And similar versions. So, yes, you can nest and have multiple +# curlies. Note there is no way to "quote" commas or curlies at this +# time, but they would be reasonably straightforward to add (Perl 6 is +# awesome). Now to try to figure out how to do this in P5, without the +# awesome grammars... +# + +grammar Expansion { + rule TOP { + ^ + * + $ + } + token element { | } + token string { <-[ \{ \} ]>+ } + token curly { \{