1. class Slang {
  2. has $.grammar;
  3. has $.actions;
  4. multi method gist(Slang:D:) {
  5. # Handle NQP objects like Perl6::Grammar
  6. 'Slang.new('
  7. ~ (':grammar(' ~ $!grammar.^name ~ ')',
  8. ':actions(' ~ $!actions.^name ~ ')').join(', ')
  9. ~ ')'
  10. }
  11. method parse (|c) {
  12. $!grammar.parse(:$!actions, |c);
  13. }
  14. }