[svn:parrot] r44667 - in branches/ops_pct/compilers/opsc: . src/Ops src/Ops/Trans
bacek at svn.parrot.org
bacek at svn.parrot.org
Fri Mar 5 23:49:44 UTC 2010
Author: bacek
Date: Fri Mar 5 23:49:43 2010
New Revision: 44667
URL: https://trac.parrot.org/parrot/changeset/44667
Log:
Add skeleton for emitter.
Added:
branches/ops_pct/compilers/opsc/src/Ops/Emitter.pm
branches/ops_pct/compilers/opsc/src/Ops/Trans/
branches/ops_pct/compilers/opsc/src/Ops/Trans.pm
branches/ops_pct/compilers/opsc/src/Ops/Trans/C.pm
Modified:
branches/ops_pct/compilers/opsc/Defines.mak
branches/ops_pct/compilers/opsc/opsc.pir
Modified: branches/ops_pct/compilers/opsc/Defines.mak
==============================================================================
--- branches/ops_pct/compilers/opsc/Defines.mak Fri Mar 5 23:49:15 2010 (r44666)
+++ branches/ops_pct/compilers/opsc/Defines.mak Fri Mar 5 23:49:43 2010 (r44667)
@@ -1,17 +1,23 @@
OPSC_DIR = compilers/opsc
-OPSC_CLEANUPS = \
- $(OPSC_DIR)/opsc.pbc \
+OPSC_SOURCES_GENERATED = \
$(OPSC_DIR)/gen/Ops/Compiler.pir \
$(OPSC_DIR)/gen/Ops/Compiler/Actions.pir \
$(OPSC_DIR)/gen/Ops/Compiler/Grammar.pir \
+ $(OPSC_DIR)/gen/Ops/Emitter.pir \
+ $(OPSC_DIR)/gen/Ops/Trans.pir \
+ $(OPSC_DIR)/gen/Ops/Trans/C.pir \
+ \
+ $(OPSC_DIR)/gen/Ops/Op.pir \
+ $(OPSC_DIR)/gen/Ops/File.pir
OPSC_SOURCES = \
$(OPSC_DIR)/opsc.pir \
$(OPSC_DIR)/src/builtins.pir \
- $(OPSC_DIR)/gen/Ops/Compiler.pir \
- $(OPSC_DIR)/gen/Ops/Compiler/Actions.pir \
- $(OPSC_DIR)/gen/Ops/Compiler/Grammar.pir \
- \
- $(OPSC_DIR)/gen/Ops/Op.pir \
- $(OPSC_DIR)/gen/Ops/File.pir
+ $(OPSC_SOURCES_GENERATED)
+
+OPSC_CLEANUPS = \
+ $(OPSC_DIR)/opsc.pbc \
+ $(OPSC_SOURCES_GENERATED)
+
+
Modified: branches/ops_pct/compilers/opsc/opsc.pir
==============================================================================
--- branches/ops_pct/compilers/opsc/opsc.pir Fri Mar 5 23:49:15 2010 (r44666)
+++ branches/ops_pct/compilers/opsc/opsc.pir Fri Mar 5 23:49:43 2010 (r44667)
@@ -13,6 +13,10 @@
.include 'compilers/opsc/gen/Ops/Compiler/Actions.pir'
.include 'compilers/opsc/gen/Ops/Compiler.pir'
+.include 'compilers/opsc/gen/Ops/Emitter.pir'
+.include 'compilers/opsc/gen/Ops/Trans.pir'
+.include 'compilers/opsc/gen/Ops/Trans/C.pir'
+
.include 'compilers/opsc/gen/Ops/Op.pir'
.include 'compilers/opsc/gen/Ops/File.pir'
Added: branches/ops_pct/compilers/opsc/src/Ops/Emitter.pm
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/ops_pct/compilers/opsc/src/Ops/Emitter.pm Fri Mar 5 23:49:43 2010 (r44667)
@@ -0,0 +1,45 @@
+#! nqp
+
+class Ops::Emitter is Hash;
+
+=begin
+
+Emitter.
+
+=end
+
+method new(:$ops_file!, :$trans!, :$script!, :$file, :%flags) {
+ self<ops_file> := $ops_file;
+ self<trans> := $trans;
+ self<script> := $script;
+ self<file> := $file;
+ self<flags> := %flags;
+
+ # Preparing various bits.
+ my $suffix := $trans.suffix();
+
+ my $base := %flags<core> ?? 'core' !! $file; #FIXME drop .ops
+ my $base_ops_stub := $base ~ '_ops' ~ $suffix;
+ my $base_ops_h := $base_ops_stub ~ '.h';
+
+
+ self<include> := %flags<dir> ~ "parrot/oplib/$base_ops_h";
+ self<header> := "include/{self<include>}";
+
+
+ self;
+};
+
+method ops_file() { self<ops_file> };
+method trans() { self<trans> };
+method script() { self<script> };
+method file() { self<file> };
+method flags() { self<flags> };
+
+
+method print_c_header_file() {
+
+}
+
+
+# vim: expandtab shiftwidth=4 ft=perl6:
Added: branches/ops_pct/compilers/opsc/src/Ops/Trans.pm
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/ops_pct/compilers/opsc/src/Ops/Trans.pm Fri Mar 5 23:49:43 2010 (r44667)
@@ -0,0 +1,14 @@
+#! nqp
+
+class Ops::Trans;
+
+=begin
+
+Base class for Runcode transformations.
+
+=end
+
+# We can't use yada-yada-yada
+method suffix() { die("...") }
+
+# vim: expandtab shiftwidth=4 ft=perl6:
Added: branches/ops_pct/compilers/opsc/src/Ops/Trans/C.pm
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/ops_pct/compilers/opsc/src/Ops/Trans/C.pm Fri Mar 5 23:49:43 2010 (r44667)
@@ -0,0 +1,6 @@
+
+class Ops::Trans::C;
+
+method suffix() { '' };
+
+# vim: expandtab shiftwidth=4 ft=perl6:
More information about the parrot-commits
mailing list