28 views

Skip to first unread message

Aug 29, 2008, 11:04:12 AM8/29/08

to concatenative, catla...@googlegroups.com

I have been working hard on a virtual machine language called CVML

(Concatenative Virtual Machine Language). I know I have been promising

this for months, but I am trying to get a working demo up and working

by the end of September. This is in large part because I want to

submit a paper to an upcoming conference (PLDI). (If anyone is

interested in reviewing the paper, please let me know, I could really

use your help.)

(Concatenative Virtual Machine Language). I know I have been promising

this for months, but I am trying to get a working demo up and working

by the end of September. This is in large part because I want to

submit a paper to an upcoming conference (PLDI). (If anyone is

interested in reviewing the paper, please let me know, I could really

use your help.)

For those with lots of imagination below is a teaser of the opcode

set. Please tear it apart. There are some strange ideas in it. It is

obviously not purely concatenative (for any definition), but it is

sufficiently so for quite a bit of analysis. The main advantages of

this bytecode are that (with only a few exceptions) we can easily

perform function call inlining, and automated subroutine extraction.

My implementation is an optimizing bytecode interpreter written in

C++, that translates from a high-level languages so it is taking a lot

of time to get everything off the ground.

enum OpCodeEnum

{

op_noop,

// literals

op_push_int,

op_push_char,

op_push_byte,

op_push_sub,

op_push_neg1,

op_push0,

op_push1,

op_push2,

op_push_true,

op_push_false,

op_push_string,

// stack shuffling

op_pop,

op_popd,

op_pop2,

op_pop3,

op_pop4,

op_dup,

op_dupd,

op_dup2,

op_dup3,

op_swap,

op_swapd,

op_swap13,

op_swap23,

op_swap14,

op_swap24,

op_swap34,

op_get,

op_get1,

op_get2,

op_get3,

op_get4,

op_set,

op_set1,

op_set2,

op_set3,

op_set4,

// integer comparison operators

op_lt_int,

op_gt_int,

op_lteq_int,

op_gteq_int,

op_eq_int,

op_neq_int,

// float comparison operators

op_lt_flt,

op_gt_flt,

op_lteq_flt,

op_gteq_flt,

op_eq_flt,

op_neq_flt,

// general comparison operators

op_lt,

op_gt,

op_lteq,

op_gteq,

op_eq,

op_neq,

// basic integer arithmetic

op_add_int,

op_sub_int,

op_div_int,

op_mul_int,

op_mod_int,

op_neg_int,

op_inc,

op_dec,

// basic floating-point arithmetic

op_add_flt,

op_sub_flt,

op_div_flt,

op_mul_flt,

op_mod_flt,

op_neg_flt,

// general arithmetic

op_add,

op_sub,

op_div,

op_mul,

op_mod,

op_neg,

// boolean operations

op_or,

op_not,

op_xor,

op_and,

// higher order functions

op_ret,

op_apply,

op_call,

op_tail_apply,

op_tail_call,

op_quote,

op_papply,

op_compose,

op_dip,

op_while,

op_if,

// objects

op_get_slot,

op_set_slot,

op_new,

op_null,

// arrays and lists

op_new_array,

op_count,

op_get_at,

op_set_at,

op_fold,

op_map,

op_filter,

op_filter_map,

op_range,

op_empty,

op_nil,

// types

op_typeof,

// used to find a name in the global environment.

// for example a standard library function

op_lookup,

// Used by the virtual machine for various purposes

op_reserved,

// Indicates that this is an extended byte-code set

op_extended

};

Reply all

Reply to author

Forward

0 new messages

Search

Clear search

Close search

Google apps

Main menu