Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[v6] More fixes; harness can do "Hello, world" now
  • Loading branch information
sorear committed Jan 4, 2011
1 parent e941d29 commit f7b008c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
1 change: 1 addition & 0 deletions v6/Begin.pm6
Expand Up @@ -7,6 +7,7 @@ use Unit;
use Sig;
use Body;
use Op;
use Metamodel;

### Code goes here to build up the metamodel from an Op tree
# We should eventually wire this to the parser, so that metamodel stuff can
Expand Down
4 changes: 2 additions & 2 deletions v6/Metamodel.pm6
Expand Up @@ -67,7 +67,7 @@ class Namespace {
}

$cursor{$k} //= ['var',Any,Any];
if !$cursor{$k}[2] {
if !defined $cursor{$k}[2] {
$.log.push(['pkg',[@$used, $k]]);
$cursor{$k}[2] = {};
}
Expand Down Expand Up @@ -560,7 +560,7 @@ class StaticSub is RefTarget {
$.lexicals{$slot} = Metamodel::Lexical::SubDef.new(:$body);
}

method add_pkg_export($unit, $name, $path2, $tags) {
method add_pkg_exports($unit, $name, $path2, $tags) {
for @$tags -> $tag {
$unit.bind_graft([@$.cur_pkg, 'EXPORT', $tag, $name], $path2);
}
Expand Down
23 changes: 20 additions & 3 deletions v6/harness
Expand Up @@ -4,14 +4,31 @@ use Body;
use Unit;
use Begin;
use JSYNC;
use NAMOutput;

my $ast = Unit.new(
name => "MAIN",
name => "CORE",
mainline => Body.new(
do => ::Op::CgOp.new(optree => ['prog', ['say', ['str', 'Hello, world']], ['null', 'var']]),
do => ::Op::StatementList.new(children => [
::Op::ClassDef.new(name => 'Mu', var => 'Mu', bodyvar => '!0',
body => Body.new(do => ::Op::StatementList.new(children => [
]))),
::Op::ClassDef.new(name => 'Any', var => 'Any', bodyvar => '!1',
body => Body.new(do => ::Op::StatementList.new(children => [
::Op::Super.new(name => 'Mu'),
]))),
::Op::ClassDef.new(name => 'Nil', var => 'Nil', bodyvar => '!2',
body => Body.new(do => ::Op::StatementList.new(children => [
]))),
::Op::ClassDef.new(name => 'ClassHOW', var => 'ClassHOW', bodyvar => '!3',
body => Body.new(do => ::Op::StatementList.new(children => [
]))),
::Op::CgOp.new(optree => ['prog', ['say', ['str', 'Hello, world']], ['null', 'var']]),
]),
returnable => False));

my %*units;
my $mm = $ast.begin;
my $nstr = NAMOutput.run($mm);

say to-jsync($mm);
say $nstr;

0 comments on commit f7b008c

Please sign in to comment.