Created
February 24, 2013 13:43
-
-
Save jnthn/5023898 to your computer and use it in GitHub Desktop.
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
use QASTJVM; | |
# Build a simple QAST tree. | |
my $cu := QAST::CompUnit.new(); | |
my $b := QAST::Block.new( | |
QAST::Op.new( | |
:op('say'), | |
QAST::SVal.new( :value('JVM compiles QAST to JVM') ) | |
)); | |
$cu.push($b); | |
$cu.main(QAST::Op.new( | |
:op('call'), | |
QAST::BVal.new( :value($b) ) | |
)); | |
# Compile it. | |
my $jast := QAST::CompilerJAST.jast($cu, :classname('JVMOnJVM')); | |
say($jast.dump); |
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
$ nqp nqp-jvm-cc.nqp cj.nqp > JVMOnJVM.dump | |
$ java -cp bin;3rdparty/bcel/bcel-5.2.jar org/perl6/nqp/jast2bc/JASTToJVMBytecode JVMOnJVM.dump JVMOnJVM.class | |
$ java -cp .;bin;3rdparty/bcel/bcel-5.2.jar JVMOnJVM | |
JVM compiles QAST to JVM |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment