Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow source written in perl6 #40

Closed
p6rt opened this issue Dec 28, 2007 · 9 comments
Closed

Allow source written in perl6 #40

p6rt opened this issue Dec 28, 2007 · 9 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Dec 28, 2007

Migrated from rt.perl.org#49173 (status was 'resolved')

Searchable as RT49173$

@p6rt
Copy link
Author

p6rt commented Dec 28, 2007

From @pmichaud

Currently all of the builtins for perl6 are written in PIR.
However, it would make more sense if some builtins were written
in Perl 6.

We have all of the pieces we need to make this happen -- we just
need (1) a logical means of keep track of builtins written in Perl 6
versus builtins written in PIR, and (2) to decide if the Perl 6
written builtins are part of a library loaded at runtime (stored where?)
or part of the perl6.pbc binary.

Pm

@p6rt
Copy link
Author

p6rt commented Feb 22, 2008

From zev-perl6@strangersgate.com

I would appreciate if someone would look over this patch before
committing it. I'm open to comments.

Zev

@p6rt
Copy link
Author

p6rt commented Feb 22, 2008

From zev-perl6@strangersgate.com

perl6-bootstrap.patch
Index: perl6.pir
===================================================================
--- perl6.pir	(revision 25992)
+++ perl6.pir	(working copy)
@@ -184,6 +184,7 @@
 .include 'src/gen_grammar.pir'
 .include 'src/parser/quote_expression.pir'
 .include 'src/gen_actions.pir'
+.include 'src/gen_include_runtime.pir'
 
 
 =back
Index: config/makefiles/root.in
===================================================================
--- config/makefiles/root.in	(revision 25992)
+++ config/makefiles/root.in	(working copy)
@@ -30,13 +30,17 @@
 
 xmas: perl6$(EXE)
 
-SOURCES = perl6.pir \
+BOOTSTRAP_SOURCES = perl6.pir \
   src/gen_grammar.pir \
   src/gen_actions.pir \
   src/gen_builtins.pir \
   src/parser/quote_expression.pir \
   $(PERL6_GROUP)
 
+SOURCES = \
+  src/gen_runtime.pir \
+  $(BOOTSTRAP_SOURCES)
+
 BUILTINS_PIR = \
   src/classes/Object.pir \
   src/classes/Bool.pir \
@@ -60,8 +64,12 @@
   src/builtins/op.pir \
   src/builtins/parrot.pir \
   src/builtins/range.pir \
+  src/builtins/system.pir \
   src/builtins/traits.pir \
 
+RUNTIME_SOURCES = \
+  src/runtime/Dummy.pm
+
 PMCS        = perl6str
 PMC_SOURCES = $(PMC_DIR)/perl6str.pmc
 PERL6_GROUP = $(PMC_DIR)/perl6_group$(LOAD_EXT)
@@ -72,9 +80,14 @@
 	$(PBC_TO_EXE) perl6.pbc
 
 # the default target
-perl6.pbc: $(PARROT) $(SOURCES)
+perl6.pbc: $(PARROT) perl6-bootstrap.pbc $(SOURCES)
+	echo ".include 'src/gen_runtime.pir'" > src/gen_include_runtime.pir
 	$(PARROT) $(PARROT_ARGS) -o perl6.pbc perl6.pir
 
+perl6-bootstrap.pbc: $(PARROT) $(BOOTSTRAP_SOURCES)
+	echo "" > src/gen_include_runtime.pir
+	$(PARROT) $(PARROT_ARGS) -o perl6-bootstrap.pbc perl6.pir
+
 src/gen_grammar.pir: $(PERL6GRAMMAR) src/parser/grammar.pg src/parser/grammar-oper.pg
 	$(PARROT) $(PARROT_ARGS) $(PERL6GRAMMAR) \
 	    --output=src/gen_grammar.pir \
@@ -85,8 +98,15 @@
 	    --target=pir src/parser/actions.pm
 
 src/gen_builtins.pir: $(BUILTINS_PIR)
-	$(CAT) $(BUILTINS_PIR) >src/gen_builtins.pir
+	$(CAT) $(BUILTINS_PIR) > src/gen_builtins.pir
 
+src/gen_runtime.pir: src/gen_runtime.pm
+	$(PARROT) $(PARROT_ARGS) perl6-bootstrap.pbc --output=src/gen_runtime.pir \
+            --target=pir src/gen_runtime.pm
+
+src/gen_runtime.pm: $(RUNTIME_SOURCES)
+	$(CAT) $(RUNTIME_SOURCES) > src/gen_runtime.pm
+
 $(PERL6_GROUP): $(PARROT) $(PMC_SOURCES)
 	cd $(PMC_DIR) && $(BUILD_DYNPMC) generate $(PMCS)
 	cd $(PMC_DIR) && $(BUILD_DYNPMC) compile $(PMCS)
@@ -150,12 +170,16 @@
 
 CLEANUPS = \
   perl6.pbc \
+  perl6-bootstrap.pbc \
   perl6.c \
   perl6$(O) \
   perl6$(EXE) \
   src/gen_grammar.pir \
   src/gen_actions.pir \
   src/gen_builtins.pir \
+  src/gen_runtime.pir \
+  src/gen_runtime.pm \
+  src/gen_include_runtime.pir \
   $(PMC_DIR)/*.h \
   $(PMC_DIR)/*.c \
   $(PMC_DIR)/*.dump \
Index: src/runtime/Dummy.pm
===================================================================
--- src/runtime/Dummy.pm	(revision 0)
+++ src/runtime/Dummy.pm	(revision 0)
@@ -0,0 +1,2 @@
+# This is a dummy runtime file.  It should be removed as soon as
+# there is a real file in this directory

@p6rt
Copy link
Author

p6rt commented May 9, 2008

From @pmichaud

If anyone wants to work on this ticket, writing a Perl 6 version of the
patch given in RT#​49085 might be a good test case or starting point.

Pm

@p6rt
Copy link
Author

p6rt commented May 9, 2008

@pmichaud - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Dec 19, 2008

From @cspencer

The attached file contains method definitions for splice and pick as
implemented in Perl 6. They have been tested as stand-alone
subroutines, but not as actual Array methods. The "is also" trait does
not yet parse parameter lists correctly, so methods can't be
successfully added to the class.

A couple of caveats​:

- The parameter lists in the methods have been fudged so as to get by
errors currently being thrown. They're not exactly as in S29. (ie.
typed optional parameters have to have a default value assigned or a
type mismatch error is thrown)

- I wasn't able to fully test them as methods, as the parser doesn't
parse it correctly it yet. They should be more or less okay, perhaps
with a couple syntactical fixes.

- It's not a patch against any given file, as I wasn't quite sure what
to patch against. :)

On Fri May 09 14​:36​:59 2008, pmichaud wrote​:

If anyone wants to work on this ticket, writing a Perl 6 version of the
patch given in RT#​49085 might be a good test case or starting point.

Pm

@p6rt
Copy link
Author

p6rt commented Dec 19, 2008

From @cspencer

proposed-pick-patch.pl

@p6rt
Copy link
Author

p6rt commented Feb 18, 2009

From @jnthn

On Fri Dec 28 15​:59​:18 2007, pmichaud wrote​:

Currently all of the builtins for perl6 are written in PIR.
However, it would make more sense if some builtins were written
in Perl 6.

And boy did it take us a little while to get there, but today we have. :-)

See under src/setting/ for various .pm files that make the start of our
Perl 6 setting (similar to what other languages call a prelude).

Also, this ticket had a patch supplying a Perl 6 implementation of
splice for Array, from cspencer. After a couple of tweaks, I have added
this to the prelude too. Thanks!

So, resolving this ticket.

Thanks,

Jonathan

@p6rt
Copy link
Author

p6rt commented Feb 18, 2009

@jnthn - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Feb 18, 2009
@p6rt p6rt added the Todo label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant