Giter Club home page Giter Club logo

cassette's Introduction

Cassette (WIP UNFINISHED)

Cassette is a new programming based off of the languages metatape, elixir, and joy, evolving syntax and semantics from each. Cassette is

  • Untyped
  • Interpreted (for now)
  • Homoiconic
  • Functional
  • Concatenive
  • Tape Based
  • Metaprogrammable (in the future).

how does it work?

If you are familier with stack langs, such as Forth, Joy, or Factor, it is common knowledge that the whole program is a stack. In Cassette it's very similar, but instead it uses a tape, which is a Circular Doubly Linked List. Internally, Cassette represents it with two stacks (look into tape.pl for more details).

This means that we can shift a tape left or right. Take for instance this tape:

1 2 3 4 5

If we shift the tape left, we get this new tape.

2 3 4 5 1

Similarly, we can move it right.

5 1 2 3 4

In Cassette you have this functionality for the whole program, quotes, and first class tapes.

Even though its a tape language, it works very much like a stack lang, using the left list as the main stack. All the pushing and popping happens there.

examples

reversing a tape:

fn [] reverse -> [] 
fn [x <: xs] reverse -> [xs reverse :> x] % examples of cons and snoc for pattern matching

fn main ::
    [1, 2, 3] reverse out
end

common stack functions:

fn x dup :: x x end
fn x y swap :: y x end
fn x y pop -> x

21 dup
5 6 swap
7 8 9 pop

or as quotes

(as x -> x x) as dup ->
(as x y -> y x) as swap ->
(as x y -> x) as pop ->

21 dup ~> % ~> evaluates a quote on the tape
5 6 swap ~>
7 8 9 pop ~>

building

Cassette can be built as a standalone executable using SWI Prolog.

$ cd cli
$ swipl -o cassette -c main.pl --goal=main
$ ./cassette ../examples/hello_world.cte
"hello world"

cassette's People

Contributors

booniepepper avatar crabbo-rave avatar josephoziel 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.