Advertisement
Guest User

Untitled

a guest
Aug 25th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. use nqp;
  2. use QAST:from<NQP>;
  3.  
  4. # Slang to make "dog" a synonym for "do"
  5.  
  6. role Dogdo::Grammar {
  7. token statement_prefix:sym<dog> { <sym><.kok> <blorst> }
  8. }
  9.  
  10. role Dogdo::Actions {
  11. method statement_prefix:sym<dog>(Mu $/) {
  12. say $/.dump;
  13. make QAST::Op.new( :op('call'), $<blorst>.ast );
  14. }
  15. }
  16.  
  17. sub EXPORT {
  18. nqp::bindkey(%*LANG, 'MAIN', %*LANG<MAIN>.HOW.mixin(%*LANG<MAIN>, Dogdo::Grammar));
  19. nqp::bindkey(%*LANG, 'MAIN-actions', %*LANG<MAIN-actions>.HOW.mixin(%*LANG<MAIN-actions>, Dogdo::Actions));
  20. {}
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement