Skip to content

Instantly share code, notes, and snippets.

@cognominal
Last active February 16, 2023 21:42
Show Gist options
  • Save cognominal/420b821abbdda40881c6a0389458fbbf to your computer and use it in GitHub Desktop.
Save cognominal/420b821abbdda40881c6a0389458fbbf to your computer and use it in GitHub Desktop.
parse
#! /usr/bin/env raku
use Grammar::Tracer;
my $s = q:to<END>;
fun a {
}
#
fun b {
whatever
}
END
grammar G {
rule TOP { <func>+ }
rule func { fun $<name>=\w+ '{' .*? ^^ \} }
}
say G.parse($s);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment