Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joes-esolangs/cassette
a new evolutionary highlevel and readable tape language (unlike brainf)
https://github.com/joes-esolangs/cassette
concatenative functional-programming homoiconic interpreter metaprogramming programming-language programming-languages prolog tape-based untyped
Last synced: 3 months ago
JSON representation
a new evolutionary highlevel and readable tape language (unlike brainf)
- Host: GitHub
- URL: https://github.com/joes-esolangs/cassette
- Owner: joes-esolangs
- License: mit
- Created: 2022-07-13T00:09:59.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-29T13:45:22.000Z (about 2 years ago)
- Last Synced: 2024-05-16T22:24:22.520Z (8 months ago)
- Topics: concatenative, functional-programming, homoiconic, interpreter, metaprogramming, programming-language, programming-languages, prolog, tape-based, untyped
- Language: Prolog
- Homepage:
- Size: 596 KB
- Stars: 15
- Watchers: 0
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-programming-languages - Cassette - A new evolutionary highlevel and readable tape language (unlike brainf), with pattern matching, arity overloading, modules, lambdas (rather quotes) and much more; All topped on with a simple and aesthetic syntax. (Uncategorized / Uncategorized)
README
# 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](https://en.wikipedia.org/wiki/Doubly_linked_list#Circular_doubly_linked_lists). Internally, Cassette represents it with two stacks (look into [tape.pl](backend/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.
# examplesreversing a tape:
```erlang
fn [] reverse -> []
fn [x <: xs] reverse -> [xs reverse :> x] % examples of cons and snoc for pattern matchingfn main ::
[1, 2, 3] reverse out
end
```common stack functions:
```erlang
fn x dup :: x x end
fn x y swap :: y x end
fn x y pop -> x21 dup
5 6 swap
7 8 9 pop
```
or as quotes
```erlang
(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 ~>
```