Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add slang example to play with
This must be loaded by a 'use' statement, not with -M
  • Loading branch information
FROGGS committed Jun 5, 2014
1 parent f036260 commit 11ef54f
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions COBOL.pm
@@ -0,0 +1,32 @@

use v6;
#~ use NQPCursor:from<NQP>;

grammar COBOL::Grammar {
#~ token statementlist($bootint) {
token statementlist(|) {
<!!{ say("in COBOLs statementlist") }>
a
}
#~ method statementlist($bootint) {
#~ say $bootint.HOW.name($bootint);
#~ NQPCursor.new;
#~ }
};

class COBOL::Actions {
method statementlist($/) {
say 'yay'
}
}

sub EXPORT(*@a) {
%*LANG<COBOL> := COBOL::Grammar;
%*LANG<COBOL-actions> := COBOL::Actions;
$*MAIN := 'COBOL';

$*W.install_lexical_symbol($*W.cur_lexpad(), '%?LANG', $*W.p6ize_recursive(%*LANG));
$*W.install_lexical_symbol($*W.cur_lexpad(), '$*MAIN', $*W.p6ize_recursive($*MAIN));

$*W.p6ize_recursive( nqp::hash() )
}

0 comments on commit 11ef54f

Please sign in to comment.