Created
June 22, 2016 17:57
-
-
Save bduggan/ffa974a931e592ad61c8e5e012297225 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
use nqp; | |
use QAST:from<NQP>; | |
sub EXPORT(|) { | |
role MOSDEF::Grammar { | |
token def { [ \'.*?\' || \".*?\" || .]*? )> <before ';'> } # ' | |
rule routine_declarator:def { <sym> <routine_def('def')> } | |
rule routine_declarator:sym<def> { <sym> <def> } | |
} | |
role MOSDEF::Actions { | |
method routine_declarator:sym<def>($/) { | |
# self.routine_declarator:def:sym<sub>($/); | |
# say 'making def'; | |
# make $<routine_def>.ast; | |
} | |
} | |
nqp::bindkey(%*LANG, 'MAIN', %*LANG<MAIN>.HOW.mixin(%*LANG<MAIN>, MOSDEF::Grammar)); | |
nqp::bindkey(%*LANG, 'MAIN-actions', %*LANG<MAIN-actions>.HOW.mixin(%*LANG<MAIN-actions>, MOSDEF::Actions)); | |
{} | |
} |
This file contains hidden or 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
use v6; | |
use lib '.'; | |
use mosdef; | |
BEGIN { | |
say 'declaring with def'; | |
} | |
def foo { | |
say 'hi' | |
}; | |
say 'calling foo'; | |
foo; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment