Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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() ) | ||
| } |