JSPM

ris-language

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q9015F
  • License MIT

Interpreter for the Reverse Instruction Set (RIS) language

Package Exports

  • ris-language
  • ris-language/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ris-language) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

RIS-Language

A Node.js interpreter for the Reverse Instruction Set (RIS) language - a minimal assembly-like language designed for OS development.

npm version License: MIT

Installation

# Install globally to use the CLI
npm install -g ris-language

# Or install locally in your project
npm install ris-language

Command Line Usage

Once installed globally, you can run RIS programs from the command line:

ris path/to/program.ris

Options:

  • --debug: Enable debug output showing execution details

Programmatic Usage

You can also use the RIS interpreter in your JavaScript code:

const ris = require('ris-language');

// Execute RIS code from a file
ris.executeFile('path/to/program.ris')
  .then(() => console.log('Program completed'))
  .catch(err => console.error('Error:', err));

// Or execute RIS code directly from a string
const code = `
PRN Hello from RIS!
VAR name = << What's your name?
PRN Nice to meet you, ${name}!
HLT
`;

ris.executeCode(code)
  .then(() => console.log('Program completed'))
  .catch(err => console.error('Error:', err));

RIS Language Basics

RIS is a minimal assembly-like language with the following instruction set:

Instructions

  • PRN: Print a message

    PRN Hello, World!
    PRN Message >> ; Output direction
  • VAR: Declare a variable

    VAR name = value
    VAR input = << Enter value: ; Input direction with prompt
  • HLT: Halt execution (required at the end of every program)

    HLT

Data Flow Operators

  • >>: Output direction
  • <<: Input direction

Variables

Reference variables using ${variable_name} syntax:

VAR name = John
PRN Hello, ${name}!

Comments

Use semicolons for comments:

; This is a comment

Examples

Hello World

; Simple Hello World program
PRN Hello, World from RIS!
HLT

User Input

; Program that asks for a name
PRN Welcome to RIS!
VAR username = << Please enter your name:
PRN Hello, ${username}! Nice to meet you!
HLT

API Reference

executeFile(filePath, options)

Executes a RIS program from a file.

  • filePath: Path to the RIS file
  • options: Configuration options
    • debug: Enable debug mode (default: false)
  • Returns: Promise that resolves when execution completes

executeCode(code, options)

Executes RIS code from a string.

  • code: RIS code to execute
  • options: Configuration options
    • debug: Enable debug mode (default: false)
  • Returns: Promise that resolves when execution completes

parseRIS(code)

Parses RIS code into an executable format.

  • code: RIS source code
  • Returns: Parsed code object

executeRIS(parsedCode, options)

Executes parsed RIS code.

  • parsedCode: Parsed RIS code from parseRIS()
  • options: Configuration options
    • debug: Enable debug mode (default: false)
  • Returns: Promise that resolves when execution completes

License

MIT