Git Product home page Git Product logo

ava's Introduction

AVA

Ava is a programming language exploring the idea of programs that can mutate and write themselves.

It is a stack based programming language, heavily inspired by Joy.

Ava programs are just a list of instructions. Ava supports the idea of quotations (meta programs) as a first class language construct.

Quotations are themselves Ava programs that can be evalulated. Unlike Joy, Ava quotations are distinct from lists.

Example

An Ava program is a sequence of instructions

Program = [ Instruction ]

A program may contain and generate other programs via quotations

Program A = [ { 1 2 3 } apply ] Program B = [ 1 2 3 ] ProgramA == ProgramB

Functions

Ava functions are just a list of instructions bound to an identifier

define square = [ dup * ]

Variables

Variables are immutable

let x = 10

let y = 20

Combinators

swap

a b swap => b a

i

The i combinator expects a quotation at the top of the stack.

{ P } i => P.

x

The x combinator

[P] x => [P] P

b

infra

L [M] [P] infra => L [N]

The infra combinator temporarily discards the current stack and takes M as the current stack state. It then executes the top quotation P which returns a new stack N. The new stack N is pushed back as a quotation onto the original stack

times

0 [P] times = id.
n [P] times = P (n-1) [P] times

branch

true  { P } { Q } branch => P.
false { P } { Q } branch => Q.

Instructions

The AVA language is made up of two layers. The lowest layer is a sequence of instructions that manipulate or modify a stack.

The lower level machine / VM instructions are

TPush
TPop
TDup
TSwap
TCons
TUncons
TChoice
TApply
TLet
TDefine
TStack
TUnstack
TInfra
TMult
TAdd
TSub
TDiv
TGt
TLt
TEq
TDot
TPrint
TNoop

ava's People

Contributors

owainlewis avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  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.