Created
May 31, 2023 02:10
-
-
Save FCO/1d9faecbfaaa6370dbefdd29be3d08d8 to your computer and use it in GitHub Desktop.
First investigation for Red using RakuAST
This file contains hidden or 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
| #!/usr/bin/env raku | |
| use v6.e.PREVIEW; | |
| # Bla.^all.map: { $_ + 1 }; | |
| say [1,2,3].map: { $_ + 1 }; | |
| CHECK { | |
| sub translate-rakuast-to-redast($raku) { | |
| return RakuAST::IntLiteral.new: 42 | |
| } | |
| for $*CU.grep: { $_ ~~ RakuAST::Call::Method && .name.canonicalize eq any <map grep first> } -> $ast { | |
| $ast.args.push: RakuAST::ColonPair::Value.new( | |
| key => "red-ast", | |
| value => RakuAST::Circumfix::Parentheses.new( | |
| RakuAST::SemiList.new( | |
| RakuAST::Statement::Expression.new( | |
| expression => translate-rakuast-to-redast($ast.args[0]) | |
| ) | |
| ) | |
| ) | |
| ); | |
| say $ast.DEPARSE; | |
| } | |
| #exit | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment