Example #1
0
 it('is valid asm.js', function() {
   assert(asm.validate(Rusha._core.toString()));
 });
Example #2
0
 it('is valid asm.js', () => {
   assert(asm.validate(Rusha._core.toString()));
 });
Example #3
0
      tokenArray[currIndex] = words.indexOf( token );
      currIndex = currIndex + 1;
    }
  }

  var compiledTokens = ArrayBuffer(currIndex * 4);
  var compiledAligned = Uint32Array(compiledTokens);
  for (i in tokenArray) {
    console.log(i, tokenArray[i]);
    compiledAligned[i] = tokenArray[i];
  };
  return( compiledTokens );
}

if ( typeof asm !== 'undefined' ) {
  var x = asm.validate( forth );
}

// Test functions
var ForthHeap = new ArrayBuffer(128);
var ForthHeap32 = new Uint32Array(ForthHeap);

// Set our initial stack to [3, 2, 1]
ForthHeap32[31] = 1;
ForthHeap32[30] = 2;
ForthHeap32[29] = 3;

// Get a compiled list of function references
compiled = compile("+ DUP ROT SWAP OVER + DUP *")
compiled32 = new Uint32Array(compiled);