Coder Social home page Coder Social logo

ape's Introduction

logo
ape

A dynamic, general-purpose programming language


Why?

This is a recreational project, so the main goal is having fun, studying language design and exploring various subjects related to it.

Features

Here a few snippets documenting the feature set of the ape programming language.

Variables and types

let age = 1;
let name = "Ape";
let result = 10 * (20 / 2);

Arrays

let array = [1, 2, 3, 4, 5];
array[0] // => 1

Maps (Hashes)

let person = {"name": "John", "age": 25};
person["name"] // => "John"

Functions

let sum = fn(a, b) { return a + b; };
sum(1, 2);

Functions (implicit return)

let prod = fn(a, b) { a * b; };
prod(1, 2);

Functions (real-world example)

let fibonacci = fn(n) {
  if (n == 0) {
    0
  } else {
    if (n == 1) {
      1
    } else {
      fibonacci(n - 1) + fibonacci(n - 2);
    }
  }
};

Functions (higher-order)

let twice = fn(f, x) {
  return f(f(x));
};

let increment = fn(x) {
  return x + 1;
};

twice(increment, 5); // => 7

Status

Currently the lexer, ast, parser and an interpreter are implemented. A full-fledged compiler is currently in the works.

Editor Support

Currently the only editor supporting Ape is the one I am using for developing it. To add support to VSCode for Ape, install the official Ape Lang extension.

Requirements

This project requires zero external dependencies, except the Go language compiler if you ever want to build it.

Benchmark

Compiling the benchmark util

go build -o benchmark.out ./benchmark

Running benchmarks

compiler + vm

./benchmark.out

interpreter

./benchmark.out -engine=eval

Contributing

As this language is still being actively designed and developed, contribution would not be practical. That said, fixes and improvements are always welcome.

ape's People

Contributors

klintmane avatar

Stargazers

Kostandin Angjellari avatar Evgeny Erohin avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.