Below, you will find my braindump of Lorito after having written a Lorito prototype. I will try and go through each Lorito page on the parrot wiki and explain my differences and the important points of each page.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{atrodo@lorito}> perl lasm.pl < t/00_sanity.t > t/00_sanity.lor | |
{atrodo@lorito}> prove -e ./lorito t/00_sanity.lor | |
t/00_sanity.lor .. ok | |
All tests successful. | |
Files=1, Tests=4, 1 wallclock secs ( 0.04 usr 0.00 sys + 0.00 cusr 0.01 csys = 0.05 CPU) | |
Result: PASS | |
{atrodo@lorito}> prove -v -e ./lorito t/00_sanity.lor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
make: `lorito' is up to date. | |
real 0m0.009s | |
user 0m0.010s | |
sys 0m0.000s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.sub comp | |
.param string hll | |
.param string code | |
$P0 = compreg hll | |
unless_null $P0, compile | |
load_language "nqprx" | |
$P0 = compreg "NQP-rx" | |
compile: | |
$P1 = $P0."compile"(code) | |
$P1 = $P1() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
procedure TDrvParrot.write(outStream: TFileStream); | |
var | |
pbc: String; | |
len: cardinal; | |
begin | |
pbc := Parrot_str_to_cstring(interp, out_pbc); | |
len := Parrot_str_byte_length(interp, out_pbc); | |
writeln(len); | |
outStream.write(PChar(pbc)^, len) | |
end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include "parrot/embed.h" | |
#include "parrot/extend.h" | |
Parrot_String create_string(Parrot_Interp interp, const char *name) | |
{ | |
return Parrot_new_string(interp, name, strlen(name), (const char *) NULL, 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hll := 'nqp'; | |
code := 'Q:PIR { say $S0 };'; | |
sa[ 0] := '.sub "" :anon'; | |
sa[ 1] := ' .param string hll'; | |
sa[ 2] := ' .param string code'; | |
sa[ 3] := ' '; | |
sa[ 4] := ' $P0 = compreg hll'; | |
sa[ 5] := ' unless_null $P0, compile'; | |
sa[ 6] := ' load_language "nqprx"'; |
NewerOlder