Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: [perl #32569] [PATCH] Signature of Parrot_compreg

8 views
Skip to first unread message

Leopold Toetsch

unread,
Nov 23, 2004, 3:32:16 AM11/23/04
to perl6-i...@perl.org
Bernhard Schmalhofer <parrotbug...@parrotcode.org> wrote:

> Parrot_compreg(Parrot_Interp interpreter, STRING *type, PMC *func)

> It claims to take a PMC, while it really take a C-function pointer.

Yes. The function was intended as a general interface to register a
compiler, which could also be a PASM/PIR Sub PMC. But the latter are
handled directly in the opcode, but the wrong signature just remained.

> As the signature of func is part of the interface of Parrot, I have also
> added a typedef
> 'Parrot_compiler_func_t' in 'parrot/interpreter.h'.

Good.

> Problematic is the file 'imcc_compile_file'. It looks like it hasn't been
> converted to returning a PMC. However it looks also like the compiler 'FILE'
> in't used anywhere.

The call is currently shortcutted and doesn't go through the compreg
hash. It should return a PackFile PMC, which we don't have yet. But that
whole area needs some more thoughts and extension anyway.

Currently imcc/main.c and the FILE compiler mostly duplicate the needed
code. Further all file extensions (.pasm, .pbc, .past) are hardcoded.
Commandline handling is restricted to imcc/main code, code loaded via
load_bytecode does only have Parrot flags available and so on.

I think we need an extension to the compreg hash, which has all needed
information:

* language
* commandline options
* filetype(s)
* commandline parser function [1]
* compiler function

[1] the existing commandline parser can be extended to either set a bit
in a passed flags variable, or run a callback.

Thanks, applied.
leo

0 new messages