New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

wasm-brainfuck

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wasm-brainfuck - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

dist/instruction-compiler.d.ts

2

dist/grammar.js

@@ -53,4 +53,4 @@ /* eslint-disable new-cap, @typescript-eslint/naming-convention */

this.OR([
{ ALT: () => this.CONSUME(RAngle) },
{ ALT: () => this.CONSUME(LAngle) },
{ ALT: () => this.CONSUME(RAngle) },
{ ALT: () => this.CONSUME(Plus) },

@@ -57,0 +57,0 @@ { ALT: () => this.CONSUME(Minus) },

@@ -1,6 +0,6 @@

import { BrainfuckCompiler, BrainfuckCompilerOptions } from './compiler.js';
export { EofBehavior } from './compiler.js';
import { BrainfuckCompiler, BrainfuckCompilerOptions } from './wasm-compiler.js';
export { EofBehavior } from './wasm-compiler.js';
export interface ExecutionResult {
dataPointer: number;
memory: Uint8Array;
dataPointer: number;
output: string;

@@ -7,0 +7,0 @@ compilationTime: number;

@@ -1,5 +0,8 @@

import binaryen from 'binaryen'; // eslint-disable-line import/no-named-as-default-member,import/no-named-as-default
import { BrainfuckCompiler } from './compiler.js';
import { parseBrainfuck } from './grammar.js';
export { EofBehavior } from './compiler.js';
import { compileInstructions } from './instruction-compiler.js';
import { optimizeContractions } from './optimizers/contract.js';
import { optimizeLoops } from './optimizers/loop.js';
import { optimizeOffsets } from './optimizers/offset.js';
import { BrainfuckCompiler } from './wasm-compiler.js';
export { EofBehavior } from './wasm-compiler.js';
export class Brainfuck {

@@ -43,5 +46,9 @@ constructor(code, options) {

});
this.compiler = new BrainfuckCompiler(new binaryen.Module(), options);
const t0 = performance.now();
this.wasmModule = this.compiler.compile(parseBrainfuck(this.code));
this.compiler = new BrainfuckCompiler(options);
const cst = parseBrainfuck(this.code);
const instructions = compileInstructions(cst);
// Apply optimizations
const optimized = optimizeOffsets(optimizeLoops(optimizeContractions(instructions)));
this.wasmModule = this.compiler.compile(optimized);
const t1 = performance.now();

@@ -69,4 +76,4 @@ this.compilationTime = t1 - t0;

return {
dataPointer,
memory: new Uint8Array(memory.buffer, 0, this.compiler.memorySize),
dataPointer,
output: this.decodeOutput(this.outputBuffer),

@@ -73,0 +80,0 @@ compilationTime: this.compilationTime,

{
"name": "wasm-brainfuck",
"version": "0.1.1",
"version": "0.1.2",
"description": "Blazing-fast Brainfuck compiler for WebAssembly",

@@ -29,2 +29,3 @@ "license": "MIT",

"prepare": "npm run build",
"benchmark": "npm run build && node ./benchmarks/benchmark.js",
"codegen": "ts-node-esm scripts/gen-dts-signatures"

@@ -44,6 +45,9 @@ },

"devDependencies": {
"@jonahsnider/benchmark": "5.0.0",
"@sindresorhus/tsconfig": "^2.0.0",
"@types/glob": "7.2.0",
"@types/node": "^16.0.30",
"ava": "^4.2.0",
"del-cli": "^4.0.1",
"glob": "8.0.1",
"ts-node": "^10.7.0",

@@ -50,0 +54,0 @@ "tslib": "^2.4.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc