-
-
Save ugexe/b3de0a3a78290061f116 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 nqp; | |
use Perl6::Grammar:from<NQP>; | |
use Perl6::Actions:from<NQP>; | |
use Perl6::Compiler:from<NQP>; | |
my $self = $?FILE.IO; | |
sub compile(*@files, Bool :$moar, Bool :$jvm, :$encoding, :$output, |c) { | |
for <moar jvm> -> $backend { | |
next if $backend eq 'jvm' && !$jvm; | |
next if $backend eq 'moar' && !$moar; | |
my ($target, $ext) = $backend.starts-with('moar') | |
?? ('mbc','moarvm') | |
!! $backend.starts-with('jvm') | |
?? ('jvm', 'jar') | |
!! ('ast', 'ast'); | |
for @files -> $file { | |
my $output = "{$file}.{$ext}"; | |
my $grammar = Perl6::Grammar.new; | |
my $actions = Perl6::Actions.new; | |
my $compiler = Perl6::Compiler.new; | |
$compiler.parseactions($actions); | |
$compiler.parsegrammar($grammar); | |
$compiler.compile($file, :$output, :$target, :$encoding, |c); | |
} | |
} | |
} | |
compile($self.IO.basename, :moar, :ll-exception(1), :encoding('utf8')); |
Author
ugexe
commented
Jul 8, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment