orcalang

0.2.0 • Public • Published

The Orca Programming Language

Orca (Egg from the book Eloquent JavaScript) is a simple programming language that supports functions, closures, and more.

do(
  print("Hello, world!"),
  define(pswd, input("What is the password? ")),
  if (==(pswd, "0rc4"),
    print("Welcome!"),
    print("Try again.")
  )
)
do(
  define(factorial, n,
    if(<=(n, 1),
      1,
      *(n, -(n, 1))
    )
  ),
  print(factorial(4)) # 24
)

Online Orca Editor

You can write and save Orca programs with syntax highlighting at https://mystpi.github.io/orca.

Installation

Orca can be installed via npm.

npm install -g orcalang

Usage

orca <filename>

Documentation

Coming soon.

Style Guide

define & set

define (var, value)
set (var, value)

do

  • should use curly braces
  • statements should be separated by semicolons
  • trailing semicolon recommended
do {
  print("Hello, world!");
  +(1, *(2, 3));
}

fun

fun (p1, p2, p3, ...; body)

if

if (cond; true; false)

if (
  cond;
  true;
  false;
)

while

while (cond; body)

while (
  cond;
  body;
)

Package Sidebar

Install

npm i orcalang

Weekly Downloads

1

Version

0.2.0

License

MIT

Unpacked Size

10.3 kB

Total Files

18

Last publish

Collaborators

  • mystpi