r2d2

package module
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2025 License: MIT Imports: 17 Imported by: 1

README

R2D2 Logo

R2D2 - The programming Language

R2D2 is a programming language designed for building modular JavaScript applications using a clear, explicit, and structured syntax.

It is written in Go and compiles to JavaScript, embracing a module-based architecture where each module can contain variables and functions. These modules are compiled into native JavaScript objects, making it easy to integrate with existing frontend or backend projects.

R2D2 introduces the concept of pseudo-functions — a special type of function that can only contain calls to other functions. This enforces composability and encourages building code through reusable, isolated behaviors.

The language is built with simplicity and clarity in mind. It avoids hidden behavior and favors explicit patterns, making it approachable for those who want to write structured, maintainable code that compiles directly to JavaScript.

You can start using R2D2 by executing the following command on your system.

For UNIX based systems

curl -sSL https://raw.githubusercontent.com/ArturC03/r2d2-cli/main/install.sh | bash

For Windows

Just use WSL, believe me. I'm doing you a favor.

To verify the installation, try executing r2d2, if it returns something you're good to go!

Hello World

Let's try to make a hello world program!

  1. Create a .r2d2 file such as helloworld.r2d2
  2. Put the following content in the file
module HelloWorld {
  export fn main() {
    console.log("Hello World!");
  }
}
  1. Now you can choose to compile, run or even convert it into a js file by using on of the following commands
r2d2 build helloworld.r2d2
r2d2 run helloworld.r2d2
r2d2 js helloworld.r2d2

For more information go to the site. Any doughts just make an issue.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCode

func BuildCode(input string, filename string) error

BuildCode executa o comando Deno compile com spinner

func BuildJSCode added in v0.1.8

func BuildJSCode(userInput string) (string, errors.ErrorCollector)

Builds the JavaScript code from the user input

func BuildJsFile added in v0.1.1

func BuildJsFile(input string, filename string) error

func RunCode

func RunCode(input string) error

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL