arini
A Language that creates Web Apps
Last updated 6 months ago by s-p-n .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install arini 
SYNC missed versions from official npm registry.

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:

  console.log("Sup?");

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.
let foo = true or false; // true
let bar = true and false; // false
console.log(foo, bar);

arini program.ari{{execute}}

  • A string can be text surrounded by "", or '', or backticks.
let foo = "I am a string.";
let bar = 'I am
    a multiline
    string';
let baz = \`
  I am a multiline string containing 2 variables:
  foo: ${foo}
  bar: ${bar}
  And that is that.
\`;
console.log(baz);

arini program.ari{{execute}}

  • A number is simply a number like JavaScript's Number.
let a = 543;
let b = 1.25;
console.log(a + b);

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.
let foo = [
    question = "What is the answer to the universe and everything?",
    answer = 42
];
console.log(foo["question"]); // "What is the..."
console.log(foo.answer); // 42 
let bar = ["cow", "pig", "sheep"];
bar.forEach(#(val) {
    console.log(val);
});

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.
let someVariable = "I'm some variable";
let someSwitch = true;
let myComponent = <someTag with="attributes">
"I am some inner text.";
<nestedTag>
 "This is a nested string in a nested tag.";
 someVariable;
 {
  if (someSwitch) {
   return <switch on=true />;
  } else {
   return <switch on=false />;
  };
 }();
</nestedTag>;
</someTag>;
console.log("" + myComponent.nestedTag.switch);

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.
let Guy {
 protected shared_secret = "it's a foo!";
 public sayHi (name = "no name") {
   return "Hello, " + name;
 };
};
let someObj = Guy();
let GuysFriend {
 use Guy;
 public tellSecret() {
  console.log(shared_secret);
 };
};
let friend = GuysFriend();
friend.tellSecret();

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.

Current Tags

  • 1.1.4-beta                                ...           latest (6 months ago)

7 Versions

  • 1.1.4-beta                                ...           6 months ago
  • 1.1.3-beta                                ...           6 months ago
  • 1.1.2-beta                                ...           9 months ago
  • 1.1.2-beta-repl                                ...           9 months ago
  • 1.1.1-beta                                ...           9 months ago
  • 1.1.0-beta                                ...           9 months ago
  • 1.0.0-alpha                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 25
Dependencies (15)
Dev Dependencies (6)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |