|
Perl 6
SMOP Mold: Revision 16
(Mold is currently under implementation)
SMOP Mold is a register based interpreter implementation A DSL called m0ld is used to represent mold opcodes in text form A Mold block(?) is composed of three parts * the number of registers used by the program (not counting the ones used to put constants or the 3 special ones) * constants - which are put into registers * opcodes The registers 1,2,3 are initialised with * interpreter * identifier * capture Mold opcodes # call invocant,identifier,named,positionals,target # call2 responder,capture,target # goto label - jumps to label # br register,iftrue,iffalse - jumps to iftruel if the native bool in register is true to iffalse otherwise $*OUT.print("hello world\n") is translated to # register declarations my $r9; my $r10; # we have to store even unused return values somewhere # constants my $r4 = $SMOP__S1P__RootNamespace; my $r5 = "postcircumfix:{ }"; my $r6 = "$*OUT"; my $r7 = "print"; my $r8 = "hello world\n"; #opcodes $r9 = $r4.$r5($r6); $r10 = $r9.$r7($8); The opcodes part ultimatly compiles to such byte code 1 4 5 1 6 0 9 1 9 7 1 8 0 10 0 |