-
-
Save cognominal/420b821abbdda40881c6a0389458fbbf to your computer and use it in GitHub Desktop.
parse
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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