General Issues
- #74
- Parrot::Interpreter - cannot use Lua
- #77
- Parrot::Interpreter - should support multi-level namespaces
- #79
- Parrot::Interpreter - run Pynie code
- #85
- Add exported function Parrot_set_HLL()
- #150
- load_bytecode, loadlib, and HLL
- #161
- abc should not evaluate to 'last' in the abc language
- #541
- r37927 segfaults on building lua
- #566
- export conventions (cross hll)
- #567
- pdd31-hll interop
- #568
- hll interop
- #744
- Assertion Failure with steme and rakudo
- #757
- Problem with threads and HLLs
- #777
- .HLL should not case-mangle its arg
- #1888
- Deprecations as data
- #2022
- Something borked with HLL mappings.
Known Workarounds
Library Loading
To provide other languages access to libraries written in your language, you must add a 'load_library' method to your compiler object. This method must accept one positional parameter, a list (or ::-delimited string?) representing the name of the library to load, and an arbitrary quantity of other named parameters (:named :slurpy), which it is (currently) free to ignore. This method should return a hash containing the following attributes:
symbols: # The only required attribute DEFAULT: # a map of names to symbols ALL: # a map of names to symbols # other named sets of symbols can go here... # the only required items are DEFAULT and ALL # You can include other additional information filename: "/path/to/filename.ext" version: "v1.0.1" author: "adent"
For existing implementations of this, look at runtime/parrot/languages/parrot/parrot.pir in the Parrot repository and perl6.pir in the rakudo repository.
An example implementation of a 'foreign_load' function:
.HLL 'example' .sub 'foreign_load' .param string lang .param string module .local pmc compiler, name, library, imports, callerns, foreignlibns $P0 = getinterp callerns = $P0['namespace';1] 'load-language'(lang) # This sub just calls the load_language opcode, but from the 'parrot' HLL, to avoid a parrot bug compiler = compreg lang name = split '::', module library = compiler.'load_library'(name) imports = library['symbols'] imports = imports['DEFAULT'] .local pmc iter, item iter = new 'Iterator', imports import_loop: unless iter goto import_loop_end $S0 = shift iter $P0 = imports[$S0] callerns[$S0] = $P0 goto import_loop import_loop_end: foreignlibns = library['namespace'] if null foreignlibns goto no_foreign_ns $S0 = pop name set_hll_global name, $S0, foreignlibns no_foreign_ns: .return (library) .end .HLL 'parrot' # Workaround for a Parrot bug .sub 'load-language' .param pmc name load_language name .end # Switch back .HLL 'example'