Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Start to build the HOW bits as part of building NQP. Means that one c…
…an now write knowhows with attributes in NQP without having to declare an attribute meta-object up front, plus the fledgeling ClassHOW is also getting built.
  • Loading branch information
jnthn committed Oct 2, 2010
1 parent 062e46d commit 77c63c7
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
18 changes: 16 additions & 2 deletions build/Makefile.in
Expand Up @@ -119,6 +119,7 @@ P6GRAMMAR_G = gen/p6grammar-grammar.pir
P6GRAMMAR_A = gen/p6grammar-actions.pir

NQP_PBC = nqp.pbc
NQP_HOW = gen/nqp-how.pir
NQP_G = gen/nqp-grammar.pir
NQP_A = gen/nqp-actions.pir
NQP_EXE = nqp$(EXE)
Expand Down Expand Up @@ -153,6 +154,10 @@ METAMODEL_OBJS = ../metamodel/rakudoobject$(O) ../metamodel/repr_registry$(O)
../metamodel/reprs/P6opaque$(O) ../metamodel/reprs/P6int$(O) \
../metamodel/reprs/P6str$(O) ../metamodel/reprs/P6num$(O)

HOW_SOURCES = src/metamodel/how/KnowHOWAttribute.pm src/metamodel/how/NQPClassHOW.pm
HOW_COMBINED = src/gen/how.pm


CLEANUPS = \
*.manifest \
*.pdb \
Expand Down Expand Up @@ -244,8 +249,14 @@ $(STAGE1)/$(P6REGEX_PBC): $(STAGE0_PBCS) $(P6REGEX_SOURCES)
$(PARROT) --include=$(STAGE1) -o $(STAGE1)/$(P6REGEX_PBC) \
src/Regex/P6Regex.pir

$(STAGE1)/$(NQP_PBC): $(STAGE0_PBCS) $(NQP_SOURCES)
$(HOW_COMBINED): $(HOW_SOURCES)
$(PERL) build/gen_how_pm.pl $(HOW_SOURCES) > $(HOW_COMBINED)

$(STAGE1)/$(NQP_PBC): $(STAGE0_PBCS) $(NQP_SOURCES) $(HOW_COMBINED)
$(MKPATH) $(STAGE1)/gen
$(PARROT) --library=$(STAGE0) $(STAGE0)/$(NQP_PBC) \
--target=pir --output=$(STAGE1)/$(NQP_HOW) \
$(HOW_COMBINED)
$(PARROT) --library=$(STAGE0) $(STAGE0)/$(NQP_PBC) \
--target=pir --output=$(STAGE1)/$(NQP_G) \
src/NQP/Grammar.pm
Expand Down Expand Up @@ -282,8 +293,11 @@ $(STAGE2)/$(P6REGEX_PBC): $(STAGE1_PBCS) $(P6REGEX_SOURCES)
$(PARROT) --include=$(STAGE2) -o $(STAGE2)/$(P6REGEX_PBC) \
src/Regex/P6Regex.pir

$(STAGE2)/$(NQP_PBC): $(STAGE1_PBCS) $(NQP_SOURCES)
$(STAGE2)/$(NQP_PBC): $(STAGE1_PBCS) $(NQP_SOURCES) $(HOW_COMBINED)
$(MKPATH) $(STAGE2)/gen
$(PARROT) --library=$(STAGE1) $(STAGE1)/$(NQP_PBC) \
--target=pir --output=$(STAGE2)/$(NQP_HOW) \
$(HOW_COMBINED)
$(PARROT) --library=$(STAGE1) $(STAGE1)/$(NQP_PBC) \
--target=pir --output=$(STAGE2)/$(NQP_G) \
src/NQP/Grammar.pm
Expand Down
26 changes: 26 additions & 0 deletions build/gen_how_pm.pl
@@ -0,0 +1,26 @@
#!/usr/bin/perl
# Copyright (C) 2010, The Perl Foundation.
# $Id$

use strict;
use warnings;

my @files = @ARGV;

print <<"END_SETTING";
#! nqp

# This file automatically generated by $0 in the nqp-rx project.

END_SETTING

foreach my $file (@files) {
print "# From $file\n\n";
open(my $fh, "<", $file) or die $!;
local $/;
my $x = <$fh>;
close $fh;
print $x;
}

print "\n# vim: set ft=perl6 nomodifiable :\n";
1 change: 1 addition & 0 deletions src/NQP/Compiler.pir
Expand Up @@ -12,6 +12,7 @@ NQP::Compiler - NQP compiler
load_bytecode 'P6Regex.pbc'
.end

.include 'gen/nqp-how.pir'
.include 'gen/nqp-grammar.pir'
.include 'gen/nqp-actions.pir'
.include 'src/cheats/nqp-builtins.pir'
Expand Down

0 comments on commit 77c63c7

Please sign in to comment.