Perl 6
SMOP sm0p Language: Revision 2

sm0p

The default implementation of the interpreter in SMOP now is pretty lame. The sm0p language is a macro language that will translate from a higher-level meaningfull language to a set of repetitive C calls that noone wants to write by hand. The exemple seems to be the better way to illustrate that.

// c code before here
continuation = q:sm0p {
   $current;
   ___INTERPRETER___;
   $obj.DESTROYALL();
   SMOP__SLIME__Operators.move_capturize(
       |SMOP__SLIME__OPCAPTURE_Move_Capturize.new(2,(3),(),3));
   SMOP__SLIME__Operators.forget();
   SMOP__SLIME__Operators.free(|$obj);
   ___INTERPRETER___.goto()
};
// c code after here

This embedded code, that means:

continuation = Frame.new(
  Node.new(
    result => $current
  ),
  Node.new(
    result => ___STACK___
  ),
  Node.new(
    responder => ___RI___($obj),
    identifier => DESTROYALL,
    capture => \( $obj: ),
  ),
  Node.new(
    responder => ___RI___(SMOP__STACK__Operators),
    identifier => move_capturize,
    capture => SMOP__STACK__OPCAPTURE_Move_Capturize.new(2,(3),(),3),
  ),
  Node.new(
    responder => ___RI___(SMOP__STACK__Operators),
    identifier => forget,
  ),
  Node.new(
    responder => ___RI___(SMOP__STACK__Operators),
    identifier => free,
    capture => $obj,
  ),
  Node.new(
    responder => ___RI___(___STACK___),
    identifier => goto
  )
);

Would be translated by a pre-processor to:

continuation = SMOP_DISPATCH
(NULL, SMOP__SLIME__Frame, SMOP__ID__new, 
 SMOP__NATIVE__capture_create
 (SMOP__SLIME__Frame,
  (SMOP__Object*[]){
    // $current;
    SMOP_DISPATCH
    (NULL, SMOP__SLIME__Node, SMOP__ID__new,
     SMOP__NATIVE__capture_create
     (SMOP__SLIME__Node, NULL,
      (SMOP__Object*[]){
        SMOP__ID__result,
        current
      })),
    // ___INTERPRETER___;
    SMOP_DISPATCH
    (NULL, SMOP__SLIME__Node, SMOP__ID__new,
     SMOP__NATIVE__capture_create
     (SMOP__SLIME__Node, NULL,
      (SMOP__Object*[]){
        SMOP__ID__result,
        ___INTERPRETER___
      })),
    // $obj.DESTROYALL();
    SMOP_DISPATCH
    (NULL, SMOP__SLIME__Node, SMOP__ID__new,
     SMOP__NATIVE__capture_create
     (SMOP__SLIME__Node, NULL,
      (SMOP__Object*[]){
        SMOP__ID__responder,
        SMOP_RI(obj),
        SMOP__ID__identifier,
        SMOP__ID__DESTROYALL,
        SMOP__ID__capture,
        SMOP__NATIVE__capture_create(obj, NULL, NULL)
      })),
    // SMOP__SLIME__Operators.move_capturize(
    //    |SMOP__SLIME__OPCAPTURE_Move_Capturize.new(2,(3),(),3));
    SMOP_DISPATCH
    (NULL, SMOP__SLIME__Node, SMOP__ID__new,
     SMOP__NATIVE__capture_create
     (SMOP__SLIME__Node, NULL,
      (SMOP__Object*[]){
        SMOP__ID__responder,
        SMOP_RI(SMOP__SLIME__Operators),
        SMOP__ID__identifier,
        SMOP__ID__move_capturize,
        SMOP__ID__capture,
        SMOP__SLIME__OPCAPTURE_Move_Capturize_new(2,(int[]){3,0}, NULL, 3)
      })),
    // SMOP__SLIME__Operators.forget();
    SMOP_DISPATCH
    (NULL, SMOP__SLIME__Node, SMOP__ID__new,
     SMOP__NATIVE__capture_create
     (SMOP__SLIME__Node, NULL,
      (SMOP__Object*[]){
        SMOP__ID__responder,
        SMOP_RI(SMOP__SLIME__Operators),
        SMOP__ID__identifier,
        SMOP__ID__forget
      })),
    // SMOP__SLIME__Operators.free(|$obj);
    SMOP_DISPATCH
    (NULL, SMOP__SLIME__Node, SMOP__ID__new,
     SMOP__NATIVE__capture_create
     (SMOP__SLIME__Node, NULL,
      (SMOP__Object*[]){
        SMOP__ID__responder,
        SMOP_RI(SMOP__SLIME__Operators),
        SMOP__ID__identifier,
        SMOP__ID__free,
        SMOP__ID__capture,
        SMOP__NATIVE__capture_create(obj, NULL, NULL)
      })),
    // ___INTERPRETER___.goto()
    SMOP_DISPATCH
    (NULL, SMOP__SLIME__Node, SMOP__ID__new,
     SMOP__NATIVE__capture_create
     (SMOP__SLIME__Node, NULL,
      (SMOP__Object*[]){
        SMOP__ID__responder,
        SMOP_RI(___INTERPRETER___),
        SMOP__ID__identifier,
        SMOP__ID__goto
      })),
  })); 
  

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: