|
@@ -1,21 +1,21 @@
|
|
|
-# TS-Starfish
|
|
|
+# TS-Sunfish
|
|
|
|
|
|
-TS-Starfish is an interpreter for the [*><>, or Starfish,](https://esolangs.org/wiki/Starfish) esoteric language written in TypeScript.
|
|
|
+TS-Sunfish is an interpreter for the [¤><>, or Sunfish,](https://esolangs.org/wiki/Starfish) esoteric language written in TypeScript.
|
|
|
|
|
|
## Summary
|
|
|
|
|
|
-*><> is a 2-dimensional, stack-based esoteric language derived from the [><>, or Fish](https://esolangs.org/wiki/Fish), language. The language is comprised of 3 main components; the Code Box, the Instruction Pointer, and the Stacks. Upon initialization, the Instruction Pointer moves through the Code Box from left to right. Each instruction encountered either changes the movement and direction of the Instruction Pointer, or performs an operation one of the Stacks. A full breakdown of the language's working can be found on its [Esolang wiki page](https://esolangs.org/wiki/Starfish).
|
|
|
+¤><> is a 2-dimensional, stack-based esoteric language derived from the [*><>, or Starfish](https://esolangs.org/wiki/Starfish), language. The language is comprised of 3 main components; the Code Box, the Instruction Pointer, and the Stacks. Upon initialization, the Instruction Pointer moves through the Code Box from left to right. Each instruction encountered either changes the movement and direction of the Instruction Pointer, or performs an operation one of the Stacks. A full breakdown of the language's working can be found on its [Esolang wiki page](https://esolangs.org/wiki/Starfish).
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
-To use the TS-Starfish interpreter, you'll first need to run `npm install ts-starfish`. From there, you can follow one of the examples shown below.
|
|
|
+To use the TS-Sunfish interpreter, you'll first need to run `npm install ts-sunfish`. From there, you can follow one of the examples shown below.
|
|
|
|
|
|
### Basic usage
|
|
|
|
|
|
The following is a bare-bones example of the `CodeBox` class. Here, we create a new instance of the `CodeBox` class and pass it a simple script that prints the number `42`. At initialization, the Code Box will output to the console.
|
|
|
|
|
|
```Javascript
|
|
|
-import { CodeBox } from "ts-starfish";
|
|
|
+import { CodeBox } from "ts-sunfish";
|
|
|
|
|
|
const cb = new CodeBox("77*7-n;"); // Prints 42
|
|
|
cb.run();
|
|
@@ -30,7 +30,7 @@ The *><> language allows the user to provide an initial stack for the Code Box t
|
|
|
In this example, we initialize the stack as `[42]`. Then, we add 15 and subtract that from 42. Finally, we output the result, 27.
|
|
|
|
|
|
```Javascript
|
|
|
-import { CodeBox } from "ts-starfish";
|
|
|
+import { CodeBox } from "ts-sunfish";
|
|
|
|
|
|
const cb = new CodeBox("f-n;", [42]); // Subtract 15 from the first number on the stack, which we provide as 42. Prints 27
|
|
|
cb.run();
|
|
@@ -41,7 +41,7 @@ cb.run();
|
|
|
You can pass any number of values to the initial stack, even as a string. For strings, each value needs to either be comma separated, or space separated.
|
|
|
|
|
|
```Javascript
|
|
|
-import { CodeBox } from "ts-starfish";
|
|
|
+import { CodeBox } from "ts-sunfish";
|
|
|
|
|
|
const cb = new CodeBox(`+l1=?v
|
|
|
;n<`, "10 12 14 16 18 20"); // Sum all numbers on the stack and then print. Prints 90
|
|
@@ -51,7 +51,7 @@ cb.run();
|
|
|
You can also include strings on the initial stack! These will be added to the stack in the form of their decimal ASCII value, and must be wrapped in either a `'` or a `"`.
|
|
|
|
|
|
```Javascript
|
|
|
-import { CodeBox } from "ts-starfish";
|
|
|
+import { CodeBox } from "ts-sunfish";
|
|
|
|
|
|
const cb = new CodeBox(`+l1=?v
|
|
|
;n<`, "'Hello, World!' 11"); // Sum the ASCII values of the input string plus the 11, and then print. Prints 1140
|
|
@@ -103,4 +103,4 @@ If you would like to contribute to the development of this package, please email
|
|
|
|
|
|
## Acknowledgements
|
|
|
|
|
|
-The original specification for *><> was written by GitHub user [RedStarCode](https://github.com/redstarcoder) in [go-starfish](https://github.com/redstarcoder/go-starfish).
|
|
|
+¤><> is forked from [RedStarCode](https://github.com/redstarcoder)'s [*><>](https://esolangs.org/wiki/Starfish) language.
|