Skip to content

Instantly share code, notes, and snippets.

@treyharris
Created February 23, 2016 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save treyharris/9f39736e766bbc0c1a8b to your computer and use it in GitHub Desktop.
Save treyharris/9f39736e766bbc0c1a8b to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl6
use v6;
grammar MyRule {
token TOP {
[<my-rule> \n+]*
}
proto token my-rule {*}
token my-rule:sym<a-or-b> {
'a' | 'b'
}
}
my $contents = slurp;
if MyRule.parse($contents) {
say "parsed";
} else {
say "noparse";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment