Advertisement
Guest User

Untitled

a guest
Apr 17th, 2012
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.32 KB | None | 0 0
  1.  
  2. grammar pq;
  3.  
  4. token identifier
  5. {
  6.   hello
  7.  
  8. }
  9.  
  10. rule S
  11. {
  12.  <identifier>
  13. }
  14.  
  15.  
  16. sub parse ($str) {
  17.     if ($str ~~ /<pq::S>/) {
  18.         #return dumptree($/<XML::Grammar::Document::TOP>);
  19.         #say $/.perl;
  20.         #dump_node($/<easyregexp::TOP><root>);
  21.                 say $str;
  22.     } else {
  23.         return "no match";
  24.     }
  25. }
  26.  
  27. parse("hello");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement