6

GitHub - analang/ana

 2 years ago
source link: https://github.com/analang/ana
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Welcome to Ana

Ana is a Python, PHP, and C inspired dynamically typed scripting language that implements object-oriented programing along with imperativeness. Learn more.

Bytecode example.

This screenshot was produced by running:

ana --opcodes -c 'print(1);'

Building

  • git clone https://github.com/analang/ana
  • cd ana
  • make
  • ana --version

Features

  • Virtual machine
  • source to bytecode compiler, intepreted by the VM
  • classes with single layered inheritance
  • dynamically sized arrays
  • built in hash map support
  • variadic functions
  • simple module system
  • built in types
  • C based runtime extension system
  • garbage collection
  • first class functions
import String;

class Logger 
{
    function Logger(buffered)
    {
      self._buffered = buffered;
      self._lines = [];
    }

    function log(fmt, ...args)
    {
      line = String.format(fmt, args);

      if(!_buffered)
      {
        print(line); 
      }
      else 
      {
        self._lines.push(line);
      }
    }
}

logger = Logger(false);

logger.log("{}", "Welcome to Ana Lang v.0.0.1");

To run this example, simply execute ana logger.ana at your shell of choice. Hint: Make sure String.ana is located in the directory of logger.ana. It's located in the lib directory.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK