Skip to content

HoshinoSuzumi/brainfuck

Repository files navigation

@uniiem/brainfuck

GitHub Actions Workflow Status NPM Downloads NPM Version (with dist tag) npm bundle size GitHub License

The reimplementation of BrainfuckJs using TypeScript.

Installtion

npm i @uniiem/brainfuck

API

declare const setDebug: (value: boolean) => boolean;

declare const execute: (program: string, input?: string) => Promise<unknown>;
declare const executeCallbackly: (program: string, input?: string, callback?: Callback) => Promise<unknown>;

// Type Definations
export type Operation = Record<string, () => void>;
export type Operator = "+" | "-" | ">" | "<" | "[" | "]" | "." | ",";
export type Callback = (runtime: Runtime) => void;
export interface Runtime {
    operator?: Operator | null;
    memory: Uint8Array;
    pointer: number;
    input: string;
    output_buffer: string;
    exited: boolean;
}

Sponsor

Buy me a coffee~

Support me on Patreon 爱发电

About

The reimplementation of BrainfuckJs using TypeScript.

Resources

License

Stars

Watchers

Forks

Packages

No packages published