Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove silly use of compreg. Try to get $?PROGRAM working, but the sp…

…ec changed...
  • Loading branch information...
commit 248146a214743d30b38e73f1ab08e6c1d803214b 1 parent 6672ae9
@chrisdolan authored
Showing with 30 additions and 14 deletions.
  1. +12 −7 Makefile
  2. +15 −6 perk.pl
  3. +3 −1 t/harness
View
19 Makefile
@@ -12,23 +12,30 @@ PM = $(shell ls lib/Perk/*.pm lib/Perk/*/*.pm)
PIR = $(PM:.pm=.pir)
PBC = $(PM:.pm=.pbc) $(T:.t=.pbc)
-all: check prebuild build
+all: build
check:
@ [ -e $(PARROT) ] || ( echo "Missing $(PARROT)" ; exit 1 )
-prebuild: $(PIR)
+prebuild: check $(PIR)
-build: perk.pbc
+build: prebuild perk.pbc
perk.pir: perk.pl
$(PERL6) --target=pir --output=$@ $<
+
#perk.pbc: perk.pir $(PERL6PBC) $(PCTPBC)
# $(PARROT) -o perk_tmp.pbc perk.pir
# $(MERGEPBC) -o $@ perk_tmp.pbc $(PERL6PBC) $(PCTPBC)
# $(RM) perk_tmp.pbc
-test: all
+test: build
$(ENV) perl t/harness
+test-parse: build
+ $(ENV) perl t/harness --target=parse
+test-past: build
+ $(ENV) perl t/harness --target=past
+test-pir: build
+ $(ENV) perl t/harness --target=pir
clean: cleanpir cleanpbc
cleanpir:
@@ -41,6 +48,4 @@ cleanpbc:
%.pbc: %.pir
$(PARROT) -o $@ $<
-.PHONY: all check test clean cleanpir cleanpbc test_trace gdb
-
-
+.PHONY: all check test test-parse test-pir test-past build prebuild clean cleanpir cleanpbc
View
21 perk.pl
@@ -4,13 +4,22 @@
use Perk::Grammar;
use Perk::Grammar::Actions;
-# env PERL6LIB='./t:./lib:../rakudo:../../runtime/parrot/library' ../../parrot ../rakudo/perl6.pbc perk.pl --target=past t/Sanity.java
+#my $perl6_compiler = q:PIR { %r = compreg 'Perl6' }; #: # close ':' for emacs highlighting glitch
+#my $compiler_name = $perl6_compiler.compiler_progname;
+#say 'Perl6 HLL Program: ', $compiler_name;
+#say 'This program: ', $?PROGRAM;
my $pct = PCT::HLLCompiler.new;
$pct.language('Perk');
-$pct.parsegrammar('Perk::Grammar'.WHICH);
-$pct.parseactions('Perk::Grammar::Actions'.WHICH); # ".WHICH" is a hack to force cast from Rakudo Str to Parrot String
+$pct.parsegrammar('Perk::Grammar'.WHICH); # ".WHICH" is a hack to force cast from Rakudo Str to Parrot String
+$pct.parseactions('Perk::Grammar::Actions'.WHICH);
-my $compiler = q:PIR { %r = compreg 'Perk' };
-@*ARGS.unshift(''); # hack to workaround PCT cmdline problem -- maybe Rakudo shifted already?
-$compiler.command_line(@*ARGS);
+# Hack: the Rakudo PCT::HLLCompiler instance already shifted args[0]
+# off, so we need to put something back on just so PCT::HLLCompiler
+# can shift it back off again.
+#@*ARGS.unshift(PROCESS::<$PROGRAM_NAME>);
+@*ARGS.unshift('perk.pbc'); # hack since program name is not implemented in Rakudo
+
+$pct.command_line(@*ARGS, :encoding('utf8'));
+#my $perk_compiler_name = $pct.compiler_progname;
+#say 'Perk HLL Program: ', $perk_compiler_name;
View
4 t/harness
@@ -28,5 +28,7 @@ find({wanted => sub {
my $parrot = File::Spec->catfile('..', '..', 'parrot');
for my $test (sort @tests) {
print "==== $test ====\n";
- system($parrot, 'perk.pbc', $test);
+ my @cmd = ($parrot, 'perk.pbc', @ARGV, $test);
+ print " cmd: @cmd\n";
+ system(@cmd);
}
Please sign in to comment.
Something went wrong with that request. Please try again.