1.1.4-beta • Published 5 years ago

arini v1.1.4-beta

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Arini

A programming language for Creators. Arini becomes Node.js.

Philosophy

A scope is any Arini file, or syntactically created using #(args){...}. A Scope is divided into 3 parts:

  • Optional name and/or arguments.
  • Declarative code - declare public, protected, or private properties.
  • construction code - invoke expressions, conditional statements, return statements, etc.

Construction code can be in the declarative section as values. Properties may not be declared outside of the declarative code.

Scopes are used for various forms of encapsulation. Scopes may be invoked, allowing the programmer to return a result of her choice, or to reveal the public properties. Scopes may be used by one-another, allowing the programmer to share protected properties.

You might notice I didn't mention methods. That's because Scopes are first-class values. Properties that have a Scope as their value, are methods. Conveniently, a creative amount of nesting is possible with Scopes, and each one may be as simple or complex as needed.

Using a single first-class encapsulation type makes Arini easy to learn and remember.

Try Arini Online

Before reading forward, all of the following content has been translated into an easy-to-take course that you can try in your web-browser for the cost of a free sign-up. https://www.katacoda.com/spn/scenarios/hello-world

Getting Started

How to create an Arini Project with npm.

First, make a directory for your project.

mkdir project{{execute}}

Now, enter that directory

cd project{{execute}}

Once you're in there, run npm init and install arini

npm init && npm i --save -g arini && npm i --save arini{{execute}}

Follow the directions from npm to initialize your Node.JS prackage.

Once that's done, create an arini program:

touch program.ari{{execute}}

Now, in your editor, open the project directory, and open up program.ari

Once opened, you can copy this code:

Run the arini program:

arini program.ari{{execute}}

That's it!

What does Arini look like?

In Arini, we have expressions, lists of expressions, identifiers, operators, and syntax used to craft those expressions. Control code (what you find in the root of an Arini program or in every scope) is a list of expressions seperated by semi-colons. Arini has a few basic types. These basic types may be used to implement more abstract types..

Primitive Types in Arini:

  • A boolean is the token true or false.

    arini program.ari{{execute}}

  • A string can be text surrounded by "", or '', or backticks.

    arini program.ari{{execute}}

  • A number is simply a number like JavaScript's Number.

    arini program.ari{{execute}}

  • An array is a map of items. Arrays, if not named, use indices just like in most programming languages. Arini also supports named arrays. One big diference between Arini and JavaScript, is arrays. Arini takes JavaScript arrays and objects and consolidates their features. Interestingly, JavaScript already does this with the Array. So Arini builds on that.

    arini program.ari{{execute}}

  • A tag is basically an XML tag- kinda like HTML. A Tag has a name and may contain attributes or children. Unlike XML/HTML, Tag children in Arini can be of any type or expression. Because of the first-class nature of Tag children, each child of a Tag must be followed by a semi-colon- just like everywhere else in the language.

    arini program.ari{{execute}}

  • A scope is kind of like a function from other languages, but has support for public and protected properties. If nothing is returned, a scope does not return void when invoked, it instead returns the public properties available. When extended, the public and protected properties are made available to the scope that extends it. private can be thought of as a synonym for let, but there are subtle differences. In essence, private and let are stored exactly the same way, just in slightly different places. They both work anywhere in the language exactly the same way- so I suggest to pick one and stick with it.

    arini program.ari{{execute}}

Now try experimenting :)

For further information on primitive types, visit the wiki.

Arini is extensible.

Node.js modules can be used with require. Arini and JavaScript are similar enough, it just works for the most part. Try it! express works, mongo-js works, socket.io works.

For more information on extensions, visit the wiki.

Base Library

Scope comes with a base library necessary for basic programming. There are some constants under development right now, but the naming is not quite right yet, so please don't use them yet. I won't mention them for that purpose, but if you see __blah don't rely on it yet.