Created
August 25, 2016 11:48
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
use lib '.'; | |
use Dogdo; | |
dog { say "woof" } |
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
use nqp; | |
use QAST:from<NQP>; | |
# Slang to make "dog" a synonym for "do" | |
role Dogdo::Grammar { | |
token statement_prefix:sym<dog> { <sym><.kok> <blorst> } | |
} | |
role Dogdo::Actions { | |
method statement_prefix:sym<dog>(Mu $/) { | |
say $/.dump; | |
make QAST::Op.new( :op('call'), $<blorst>.ast ); | |
} | |
} | |
sub EXPORT { | |
nqp::bindkey(%*LANG, 'MAIN', %*LANG<MAIN>.HOW.mixin(%*LANG<MAIN>, Dogdo::Grammar)); | |
nqp::bindkey(%*LANG, 'MAIN-actions', %*LANG<MAIN-actions>.HOW.mixin(%*LANG<MAIN-actions>, Dogdo::Actions)); | |
{} | |
} |
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
===SORRY!=== | |
X::Multi::NoMatch exception produced no message |
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
- sym: dog | |
- blorst: { say "woof" } | |
- block: { say "woof" } | |
- blockoid: { say "woof" } | |
- statementlist: say "woof" | |
- statement: 1 matches | |
- EXPR: say "woof" | |
- longname: say | |
- name: say | |
- identifier: say | |
- args: "woof" | |
- arglist: "woof" | |
- EXPR: "woof" | |
- value: "woof" | |
- quote: "woof" | |
- nibble: woof | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment