Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@kasz/virtlang

dev-kas23MIT0.1.2

Virt(ual)Lang(uage) - General Purpose Programming Language

virtlang, virtual, language, general, purpose, programming

readme

VirtLang Interpreter

Deprecation Warning

Since 18th March 2025 this module will be deprecated and no longer maintained.

VirtLang is a simple interpreted language designed for educational purposes. This README provides instructions on how to set up, build, and run the VirtLang interpreter.

Getting Started

Prerequisites

Ensure you have Node.js and npm installed on your machine. You can download them from Node.js official website.

Installation

Clone the repository and install the dependencies:

mkdir myVirtLangProject && cd MyVirtLangProject
npm install @kasz/virtlang

Usage

Create a .vl file with your VirtLang code. For example, main.vl:

--> i am a comment

out.print("Hello world this is some message")

--> i am another comment

--<
some comments
out.error("Error here")
out.warn("Hello world this is a warning")
>--

out.print("Hello world this is some message 22")

Create a main.js file with the following code:

const { Parser, createGlobalEnv, evaluate } = require("@kasz/virtlang");
const { readFileSync } = require("fs");

const code = readFileSync("main.vl", "utf-8");

const parser = new Parser();
const env = createGlobalEnv();

const ast = parser.produceAST(code);
evaluate(ast, env);

Run the interpreter:


node main.js

Contributing

Contributions are welcome! Please fork the repository and submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.