Skip to content

Instantly share code, notes, and snippets.

@FROGGS
Created June 10, 2014 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FROGGS/d0c2388c0e044830f4b0 to your computer and use it in GitHub Desktop.
Save FROGGS/d0c2388c0e044830f4b0 to your computer and use it in GitHub Desktop.
use v6;
use QAST:from<NQP>;
grammar COBOL::Grammar {
token statementlist($bootint) {
.*
}
};
class COBOL::Actions {
method statementlist($/) {
make QAST::Op.new( :op<say>, QAST::SVal.new( :value<awesome!!> ))
}
}
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() )
}
perl6 -I. -e 'use COBOL; ...'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment