Advertisement
Guest User

Untitled

a guest
Dec 10th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. my $input = '(((';
  2.  
  3. grammar Test {
  4.     token TOP {
  5.         ^<down>*$
  6.     }
  7.  
  8.     token down {
  9.         ^\($
  10.     }
  11. }
  12.  
  13. class TestActions {
  14.     method TOP ($/) {
  15.          make @<down>>>.ast;
  16.     }
  17.     method down ($/) {
  18.         make 1;
  19.     }
  20. }
  21.  
  22. my $actions = TestActions.new;
  23. my $res = Test.parse($input, :$actions);
  24. say $res.made;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement