stepcode
TypeScript icon, indicating that this package has built-in type declarations

0.12.0 • Public • Published

StepCode

StepCode is a pseudo-code language for writing step-by-step instructions. It is designed to be easy to read and write, and to be easily converted to other languages. It is based on the syntax of PSeInt, a pseudo-code language for teaching programming.

About this repository

This repository contains the source code for the StepCode interpreter for NodeJS/Browser. It uses the ANTLR parser generator.

Installation

To install the StepCode interpreter, run the following command:

npm install stepcode

Usage

To use the StepCode interpreter, you must first import the interpreter

import { interpret, EventBus } from 'stepcode';

Create an event bus to receive events from the interpreter:

const eventBus = new EventBus();

eventBus.on('output-request', (message: string) => {
    console.log(message);
});

eventBus.on('input-request', (resolve: (s: string) => void) => {
  console.log(message);
});

Then, you can interpret a StepCode program by calling the interpret function:

const result = interpret({
    code: `Proceso HolaMundo
        Escribir "Hola mundo";
    FinProceso`,
});

The interpret function returns a promise that resolves to the result of the program.

Package Sidebar

Install

npm i stepcode

Weekly Downloads

0

Version

0.12.0

License

none

Unpacked Size

921 kB

Total Files

5

Last publish

Collaborators

  • rolandoandrade