Author: bernhard
Date: Thu Sep 29 11:10:40 2005
New Revision: 9279
Modified:
trunk/languages/parrot_compiler/README
trunk/languages/parrot_compiler/parrot.pasm
trunk/languages/parrot_compiler/parrot_compiler.imc
trunk/languages/parrot_compiler/t/basic/hello.t
trunk/t/pmc/eval.t
Log:
Pass a couple of tests in 'languages/parrot_compiler'
Modified: trunk/languages/parrot_compiler/README
==============================================================================
--- trunk/languages/parrot_compiler/README (original)
+++ trunk/languages/parrot_compiler/README Thu Sep 29 11:10:40 2005
@@ -2,5 +2,9 @@
# $Id$
'languages/parrot_compiler' is not really a language implementation.
-It servers as an example on how the builtin PASM, PIR and PAST compilers
+
+It just provides examples on how the builtin PASM, PIR and PAST compilers
can be used in PIR, PASM and PAST scripts.
+
+See also t/pmc/eval.t, t/src/compilers.t, examples/compilers and
+languages/m4/src/eval.c.
Modified: trunk/languages/parrot_compiler/parrot.pasm
==============================================================================
--- trunk/languages/parrot_compiler/parrot.pasm (original)
+++ trunk/languages/parrot_compiler/parrot.pasm Thu Sep 29 11:10:40 2005
@@ -4,11 +4,15 @@
# Get the input as a string, don't care about buffer overflow yet
read S0, 1000000
- # Assume that the input is PASM and compile it
+ # Get a handle on the builtin PASM compiler
compreg P1, "PASM"
- compile P0, P1, S0
- # Dumping the Eval PMC as a string seems to be unimplemented,
- # so simple invoke it
- invoke P0
+ # compile the code
+ set_args "(0)", S0
+ get_results "(0)", P0
+ invokecc P1
+
+ # evaluate the compiled code
+ invokecc P0
+
end
Modified: trunk/languages/parrot_compiler/parrot_compiler.imc
==============================================================================
--- trunk/languages/parrot_compiler/parrot_compiler.imc (original)
+++ trunk/languages/parrot_compiler/parrot_compiler.imc Thu Sep 29 11:10:40 2005
@@ -44,10 +44,9 @@
# Assume that the input is PASM and compile it
compreg P1, language
- compile P0, P1, S0
+ P0 = P1( S0 )
- # Dumping the Eval PMC as a string seems to be unimplemented,
- # so simple invoke it
- invoke P0
+ # invoke the compiled code
+ P0()
.end
Modified: trunk/languages/parrot_compiler/t/basic/hello.t
==============================================================================
--- trunk/languages/parrot_compiler/t/basic/hello.t (original)
+++ trunk/languages/parrot_compiler/t/basic/hello.t Thu Sep 29 11:10:40 2005
@@ -3,6 +3,8 @@
use strict;
use lib 'parrot_compiler/lib';
+use FindBin;
+use lib "$FindBin::Bin/../../lib", "$FindBin::Bin/../../../../lib";
use Parrot::Test tests => 2+3 + 3 + 3;
use Test::More;
@@ -10,13 +12,18 @@ use Test::More;
# Execute 'Hello World' in PASM, PIR and PAST
my %code = ( PASM => << 'END_PASM', PIR => << 'END_PIR', PAST => << 'END_PAST'
);
+
print "Hello, this is PASM.\n"
end
END_PASM
+
+
.sub test @MAIN
print "Hello, this is PIR.\n"
.end
END_PIR
+
+
Parrot_AST(
version(Const('0.1'))
_options(
Modified: trunk/t/pmc/eval.t
==============================================================================
--- trunk/t/pmc/eval.t (original)
+++ trunk/t/pmc/eval.t Thu Sep 29 11:10:40 2005
@@ -1,6 +1,6 @@
#! perl -w
-# Copyright: 2001-2004 The Perl Foundation. All Rights Reserved.
+# Copyright: 2001-2005 The Perl Foundation. All Rights Reserved.
# $Id$
=head1 NAME