From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=0.8 required=3.0 tests=BAYES_50,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:a37:8204:: with SMTP id e4mr14943221qkd.351.1608580096598; Mon, 21 Dec 2020 11:48:16 -0800 (PST) X-Received: by 2002:a37:63d1:: with SMTP id x200mr18534572qkb.164.1608580096430; Mon, 21 Dec 2020 11:48:16 -0800 (PST) Path: eternal-september.org!reader02.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 21 Dec 2020 11:48:16 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=2a02:1206:4564:fe50:49da:b719:97c7:3117; posting-account=gRqrnQkAAAAC_02ynnhqGk1VRQlve6ZG NNTP-Posting-Host: 2a02:1206:4564:fe50:49da:b719:97c7:3117 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <52690d99-a8ed-40c3-b3c3-8d54875506a5n@googlegroups.com> Subject: Re: Advent of Code, Day 19 From: Gautier Write-Only Address Injection-Date: Mon, 21 Dec 2020 19:48:16 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:60915 List-Id: For me the first part was the tough one. I've tried for too long to structure the rules verification like this procedure Verify_Rule (...) is ... procedure Verify_Rule_List (...) is ... begin loop on the list, call recursively Verify_Rule end; end; But a loop cannot be used here, each subrule can consume a variable range of characters in the string and there are multiple tails of the string for the next subrule for the loop. So the solution in that case was to delegate everything further to recursion. Part two was (in my case) a matter of applying the indicated rules modification. if part = 2 then rule (8) := (is_terminal => False, max => 3, alt => 2, sub => (42, 42, 8, -1, -1)); rule (11) := (is_terminal => False, max => 5, alt => 3, sub => (42, 31, 42, 11, 31)); end if;