Coder Social home page Coder Social logo

shelf's Introduction

     +--+---+-+       +--------+         +---+-+--+--+
    /  /   / /|      / Shelf  /|        /   / /  /  /|
   +--+---+-+ |     +------- + |       +---+-+--+--+ |
   |  |   | | |     |a small | |       |   | |  |  | |
---|  |   | | +-----| stack  | +-------|   | |  |  | +----/|
   |  |   | |/      |language|/        |   | |  |  |/    //
---+--+---+-+-------+--------+---------+---+-+--+--+----//
-------------------------------------------------------|/


---Shelf-/
--------/

   Shelf is a functional, dynamic, stack-based language.


---Features-/
-----------/

   * Mostly pure functional. There's an impure print word
     and print-stack word, but that's about it. Functions
     are first class values.

   * Stack-based. All words (functions) take their
     parameters off the stack. Basically, all data resides
     on the stack.

   * Garbage Collected. Shelf is an interpreter written in
     OCaml, and as such, benefits from the underlying
     garbage collection.

   * Functional Interpreter. The interpreter is implemented
     using immutable data structures, so it's thread safe.

   * Arbitrary precision numbers. No need to worry about
     overflowing.


---Building-/
-----------/

   $ omake

   For more options, see INSTALL file.


---Examples-/
-----------/

   * Basic

      >>> "hello world" print
      "hello world"
      Stack:

      >>> 2 2 +
      Stack: 4

      >>> 3 2 -
      Stack: 1

   * Lists

      >>> [1 2 3 4 5] list
      Stack: (1,2,3,4,5)

      >>> [1 2 3 4] list head
      Stack: (2,3,4) 1

   * Anonymous functions

      >>> 1 2 [+] apply
      Stack: 3

      >>> 1 2 < ["logic makes sense"] ["alt universe"] if
      Stack: "logic makes sense"

   * Named functions

      >>> def fac { dup 0 = [pop 1] [dup 1 - fac *] if }
      Stack:
      >>> 5 fac
      Stack: 120
      >>> pop 39 fac
      Stack: 20397882081197443358640281739902897356800000000


---License-/
----------/

   Shelf is free software: you can redistribute it and/or
   modify it under the terms of the GNU General Public
   License as published by the Free Software Foundation,
   either version 3 of the License, or (at your option) any
   later version.

   A copy of the license can be found in the LICENSE file.

                             ~~~

                         ______________
      _/\|\_\_          / Programmer,  \
    _| .-     \___     / use the Stack! \
    \/     )     o`o _/_________________/
   </  ) _/_ )-.___/
   /  /\(  (/
   | (__`'` '`
    '--.)

shelf's People

Contributors

alexleighton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.