Perl 6
Default SMOP Interpreter Implementation: Revision 1

The default SMOP Interpreter Implementation is a mixture of a stack-based and a stackless machine, as it does support pushing new frames, but it also supports continuation passing style inside itself. This implementation is based on three elements:

  • A Node prototype and its instances
  • A Stack prototype and its instances
  • Lowlevel operators that manipulate the Stack

Node Prototype

The Node prototype just declares an object that have a set of members.

  • responder
  • identifier
  • capture
  • debug
  • jail
  • lexical
  • outer
  • continuation
  • past
  • result

This members can be passed to Node.new() as named arguments.

Stack Prototype

The Stack prototype defines the implementation in itself, it's the one with the "eval" method. It simply have a reference to the currently selected Node, and have the following methods.

  • new(SMOP__STACK__Stack: $initial_node?) -- creates a new stack object, optionally defining a initial node.
  • push($stack: $node) -- push the node to the stack, saving the older node as the new node's outer node.
  • continues($stack: $node) -- set the given node as a continuation to the current node.
  • next($stack: ) -- goes to the next node in the stack, possibly drop frames.
  • current($stack: ) -- returns the currently selected node.
  • goto($stack: $node) -- sets the node as the currently selected node.
  • eval($stack: ) -- evaluates the currently selected node and stores the result in the result field of the node.
  • result($stack: $count) -- gets the result of the past node that is $count away from the current node.
  • has_next($stack: ) -- returns true if there's any more node to eval.
  • loop($stack: ) -- iterates in the stack and return when has_next is false.

Stack transformations

Some of the above methods transform the stack in interesting ways. Follows some ascii diagrams on how that works.

push

Before
                               *
   Current Frame     1 <- 2 <- 3 -> 4 -> 5

After
                               *
   New Frame              given node
                               |
   Current Frame     1 <- 2 <- 3 -> 4 -> 5

next

     *                            *
1 <- 2 -> 3  turns into 1 <- 2 <- 3
     |                            |

and

          *
1 <- 2 <- 3  turns into 
          |                  *
     1 <- 2             1 <- 2

Upload Files

Click "Browse" to find the file you want to upload. When you click "Upload file" your file will be uploaded and added to the list of attachments for this page.

Maximum file size: 50MB

 
 
 
File Name Author Date Uploaded Size

Save Page As

Enter a meaningful and distinctive title for your page.

Page Title:

Tip: You'll be able to find this page later by using the title you choose.

Page Already Exists

There is already a page named XXX. Would you like to:

Save with a different name:

Save the page with the name "XXX"

Append your text to the bottom of the existing page named: "XXX"

Upload Files

Click "Browse" to find the file you want to upload. When you click "Add file" this file will be added to the list of attachments for this page, and uploaded when you save the page.

 
 
 
Add Tags

Enter a tag and click "Add tag". The tag will be saved when you save the page.

Tag: 

Suggestions: