Index: t/compilers/pct/pct_hllcompiler.t
===================================================================
--- t/compilers/pct/pct_hllcompiler.t	(revision 0)
+++ t/compilers/pct/pct_hllcompiler.t	(revision 0)
@@ -0,0 +1,167 @@
+#!perl
+
+# Copyright (C) 2005-2006, The Perl Foundation.
+# $Id: hllcompiler.t 20964 2007-08-31 19:49:25Z bernhard $
+
+use strict;
+use warnings;
+use lib qw(t . lib ../lib ../../lib ../../../lib);
+use Test::More;
+use Parrot::Test tests => 4;
+
+pir_output_is( <<'CODE', <<'OUT', 'some of the auxiliary methods' );
+
+.sub _main :main
+    load_bytecode 'PCT/HLLCompiler.pbc'
+    $P0 = new 'PCT::HLLCompiler'
+
+    # parse_name method
+    $P1 = $P0.'parse_name'('None::Module')
+    $S1 = $P1[0]
+    say $S1
+    $S1 = $P1[1]
+    say $S1
+
+    $P0.'parsegrammar'('None::Parser')
+    $S1 = $P0.'parsegrammar'()
+    say $S1
+
+    $P0.'astgrammar'('None::Grammar')
+    $S1 = $P0.'astgrammar'()
+    say $S1
+
+    end
+.end
+CODE
+None
+Module
+None::Parser
+None::Grammar
+OUT
+
+pir_output_is( <<'CODE', <<'OUT', 'one complete start-to-end compiler' );
+
+.namespace [ 'NoneParser' ]
+
+.sub 'TOP'
+    .param string source
+    .return (source)
+.end
+
+.namespace [ 'NoneBuilder' ]
+
+.sub 'init' :anon :load :init
+    load_bytecode 'Protoobject.pbc'
+    $P0 = get_hll_global 'Protomaker'
+    $P1 = $P0.'new_subclass'('Protoobject', 'NoneBuilder', 'text')
+.end
+
+.sub 'get' :method
+    .param string stage
+
+    $P0 = new 'PAST::Op'
+    $P0.'pasttype'('inline')
+    $P0.'inline'("print %0\nprint \"\\n\"")
+
+    $P2 = getattribute self, "text"
+    $P1 = new 'PAST::Val'
+    $P1.'value'($P2)
+
+    $P0.'push'($P1)
+
+    .return ($P0)
+.end
+
+.sub 'text' :method
+    .param pmc word
+    setattribute self, 'text', word
+.end
+
+.namespace [ 'NoneGrammar' ]
+
+.sub 'init' :anon :load :init
+    load_bytecode 'Protoobject.pbc'
+    $P0 = get_hll_global 'Protomaker'
+    $P1 = $P0.'new_subclass'('Protoobject', 'NoneGrammar')
+.end
+
+.sub 'apply' :method
+    .param pmc source
+
+    $P0 = new 'NoneBuilder'
+    $P0.'text'(source)
+
+    .return ($P0)
+.end
+
+.namespace [ 'None::Compiler' ]
+
+.sub _main :main
+    load_bytecode 'PCT.pbc'
+
+    $P0 = new 'PCT::HLLCompiler'
+    $P0.'language'('None')
+    $P0.'parsegrammar'('NoneParser')
+    $P0.'astgrammar'('NoneGrammar')
+
+    .local pmc args
+    args = new 'ResizableStringArray'
+    push args, "command"
+    push args, "-e"
+    push args, "thingy"
+    $P1 = $P0.'command_line'(args)
+
+    .return()
+.end
+
+
+CODE
+thingy
+OUT
+
+pir_output_is( <<'CODE', <<'OUT', 'default stages' );
+.sub _main :main
+    load_bytecode 'PCT/HLLCompiler.pbc'
+
+    .local pmc hllcompiler
+    hllcompiler = new 'PCT::HLLCompiler'
+
+    $P0 = getattribute hllcompiler, "@stages"
+    $S0 = join " ", $P0
+    say $S0
+    .return()
+.end
+
+CODE
+parse past post pir evalpmc
+OUT
+
+pir_output_is( <<'CODE', <<'OUT', 'inserting and removing stages' );
+.sub _main :main
+    load_bytecode 'PCT/HLLCompiler.pbc'
+
+    .local pmc hllcompiler
+    hllcompiler = new 'PCT::HLLCompiler'
+
+    hllcompiler.removestage('parse')
+    hllcompiler.addstage('foo')
+    hllcompiler.addstage('bar', 'before' => 'evalpmc')
+    hllcompiler.addstage('optimize', 'after' => 'past')
+    hllcompiler.addstage('optimize', 'after' => 'post')
+    hllcompiler.addstage('peel', 'after' => 'optimize')
+    $P0 = getattribute hllcompiler, "@stages"
+    $S0 = join " ", $P0
+    say $S0
+    .return()
+.end
+
+CODE
+past optimize peel post optimize peel pir bar evalpmc foo
+OUT
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
Index: t/compilers/pct/post.t
===================================================================
--- t/compilers/pct/post.t	(revision 0)
+++ t/compilers/pct/post.t	(revision 0)
@@ -0,0 +1,90 @@
+#! perl
+
+# Copyright (C) 2006-2007, The Perl Foundation.
+# $Id: post.t 21253 2007-09-13 06:36:36Z paultcochrane $
+
+use strict;
+use warnings;
+use lib qw(t . lib ../lib ../../lib ../../../lib);
+use Parrot::Test tests => 6;
+
+foreach my $name (qw(Op Ops Sub Label)) {
+    my $module = "POST::$name";
+    my $code   = <<'CODE'
+.sub _main
+    load_bytecode 'PCT.pbc'
+    load_bytecode 'Dumper.pbc'
+    .local pmc node
+    .local pmc node2
+CODE
+        ;
+
+    $code .= "    node = new '$module'\n";
+    $code .= "    node2 = new '$module'\n";
+    $code .= <<'CODE'
+    node.'init'('name' => 'foo')
+    node2.'init'('name' => 'bar')
+    node.'push'(node2)
+
+    $P1 = node.'name'()
+    say $P1
+    "_dumper"(node, "ost")
+    .return ()
+.end
+CODE
+        ;
+
+    pir_output_is( $code, <<"OUT", "set attributes for $module via method" );
+foo
+"ost" => PMC '$module'  {
+    <name> => "foo"
+    [0] => PMC '$module'  {
+        <name> => "bar"
+    }
+}
+OUT
+
+}
+
+pir_output_is( <<'CODE', <<'OUT', 'dump POST::Op node in visual format' );
+.sub _main
+    load_bytecode 'PCT.pbc'
+    load_bytecode 'Dumper.pbc'
+    .local pmc node
+    node = new 'POST::Op'
+    node.'pirop'('add')
+    node.'result'('$P1')
+    node.'inline'('%r=1')
+    "_dumper"(node, "ost")
+    .return ()
+.end
+CODE
+"ost" => PMC 'POST::Op'  {
+    <pirop> => "add"
+    <result> => "$P1"
+    <inline> => "%r=1"
+}
+OUT
+
+pir_output_is( <<'CODE', <<'OUT', 'dump POST::Label node in visual format' );
+.sub _main
+    load_bytecode 'PCT.pbc'
+    load_bytecode 'Dumper.pbc'
+    .local pmc node
+    node = new 'POST::Label'
+    node.'name'('labeler')
+    "_dumper"(node, "ost")
+    .return ()
+.end
+CODE
+"ost" => PMC 'POST::Label'  {
+    <name> => "labeler"
+}
+OUT
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
Index: t/compilers/pct/past.t
===================================================================
--- t/compilers/pct/past.t	(revision 0)
+++ t/compilers/pct/past.t	(revision 0)
@@ -0,0 +1,139 @@
+#! perl
+
+# Copyright (C) 2006-2007, The Perl Foundation.
+# $Id: past.t 21253 2007-09-13 06:36:36Z paultcochrane $
+
+use strict;
+use warnings;
+use lib qw(t . lib ../lib ../../lib ../../../lib);
+use Parrot::Test tests => 10;
+
+foreach my $name (qw(Node Val Var Op Block Stmts)) {
+    my $module = "PAST::$name";
+    my $code   = <<'CODE'
+.sub _main
+    load_bytecode 'PCT.pbc'
+    load_bytecode 'Dumper.pbc'
+    .local pmc node
+    .local pmc node2
+CODE
+        ;
+
+    $code .= "    node = new '$module'\n";
+    $code .= "    node2 = new '$module'\n";
+    $code .= <<'CODE'
+    node.'init'('name' => 'foo')
+    node2.'init'('name' => 'bar')
+    node.'push'(node2)
+
+    $P1 = node.'name'()
+    say $P1
+    "_dumper"(node, "ast")
+    .return ()
+.end
+CODE
+        ;
+
+    pir_output_is( $code, <<"OUT", "set attributes for $module via method" );
+foo
+"ast" => PMC '$module'  {
+    <name> => "foo"
+    [0] => PMC '$module'  {
+        <name> => "bar"
+    }
+}
+OUT
+
+}
+
+pir_output_is( <<'CODE', <<'OUT', 'dump PAST::Val node in visual format' );
+.sub _main
+    load_bytecode 'PCT.pbc'
+    load_bytecode 'Dumper.pbc'
+    .local pmc node
+    node = new 'PAST::Val'
+    node.'value'(1)
+    node.'returns'('Integer')
+    $P1 = node.'value'()
+    say $P1
+    $P1 = node.'returns'()
+    say $P1
+    "_dumper"(node, "ast")
+    .return ()
+.end
+CODE
+1
+Integer
+"ast" => PMC 'PAST::Val'  {
+    <value> => 1
+    <returns> => "Integer"
+}
+OUT
+
+## TODO: test that return() is taken from the type of value when not specified
+
+## TODO: check the rest of the PAST::Var attributes
+pir_output_is( <<'CODE', <<'OUT', 'dump PAST::Var node in visual format' );
+.sub _main
+    load_bytecode 'PCT.pbc'
+    load_bytecode 'Dumper.pbc'
+    .local pmc node
+    node = new 'PAST::Var'
+    node.'scope'('foo')
+    node.'viviself'('baz')
+    node.'lvalue'('buz')
+    "_dumper"(node, "ast")
+    .return ()
+.end
+CODE
+"ast" => PMC 'PAST::Var'  {
+    <scope> => "foo"
+    <viviself> => "baz"
+    <lvalue> => "buz"
+}
+OUT
+
+pir_output_is( <<'CODE', <<'OUT', 'dump PAST::Op node in visual format' );
+.sub _main
+    load_bytecode 'PCT.pbc'
+    load_bytecode 'Dumper.pbc'
+    .local pmc node
+    node = new 'PAST::Op'
+    node.'pasttype'('pirop')
+    node.'pirop'('add')
+    node.'lvalue'('foo')
+    node.'inline'('%r = add %0, %1')
+    "_dumper"(node, "ast")
+    .return ()
+.end
+CODE
+"ast" => PMC 'PAST::Op'  {
+    <pasttype> => "pirop"
+    <pirop> => "add"
+    <lvalue> => "foo"
+    <inline> => "%r = add %0, %1"
+}
+OUT
+
+pir_output_is( <<'CODE', <<'OUT', 'dump PAST::Block node in visual format' );
+.sub _main
+    load_bytecode 'PCT.pbc'
+    load_bytecode 'Dumper.pbc'
+    .local pmc node
+    node = new 'PAST::Block'
+    node.'blocktype'('declaration')
+    "_dumper"(node, "ast")
+    .return ()
+.end
+CODE
+"ast" => PMC 'PAST::Block'  {
+    <blocktype> => "declaration"
+}
+OUT
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
Index: t/harness
===================================================================
--- t/harness	(revision 25554)
+++ t/harness	(working copy)
@@ -168,6 +168,7 @@
     t/compilers/pge/p5regex/*.t
     t/compilers/pge/perl6regex/*.t
     t/compilers/tge/*.t
+    t/compilers/pct/*.t
     t/library/*.t
 );
 
