Created
November 28, 2020 12:25
-
-
Save samebchase/0820b9ecfdb011a9b73aedfb4ba349d1 to your computer and use it in GitHub Desktop.
simple-ns.raku
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 v6.d; | |
use Grammar::Tracer; | |
grammar SimpleNs { | |
token TOP { <simple-ns> } | |
token simple-ns { <lparen> <ns-keyword> <.ws> <ns-name> <rparen> } | |
token ns-keyword { 'ns' } | |
token ns-name { <.ns-name-component>+ % '.' } | |
token ns-name-component { ( <.alnum> | '-' )+ } | |
token lparen { '(' } | |
token rparen { ')' } | |
} | |
sub MAIN() { | |
say SimpleNs.parse("(ns foo.bar.baz-quux)"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment