Преглед изворни кода

Change package name to Sunfish

Ambitions for the language going forward have prompted me to instead for
the Starfish language into a new one, which I am calling ¤><> or
Sunfish.
ApisNecros пре 1 година
родитељ
комит
8df4e2412e
4 измењених фајлова са 22 додато и 21 уклоњено
  1. 9 9
      README.md
  2. 4 3
      package.json
  3. 3 3
      src/codebox.ts
  4. 6 6
      src/errors.ts

+ 9 - 9
README.md

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

+ 4 - 3
package.json

@@ -1,7 +1,7 @@
 {
-  "name": "ts-starfish",
+  "name": "ts-sunfish",
   "version": "0.9.0",
-  "description": "an interpreter for the *><> esolang written in TypeScript",
+  "description": "an interpreter for the ¤><> esolang written in TypeScript",
   "main": "dist/main.js",
   "type": "module",
   "scripts": {
@@ -11,6 +11,7 @@
   "keywords": [
     "esolang",
     "starfish",
+    "sunfish",
     "fish",
     "esoteric",
     "language"
@@ -19,7 +20,7 @@
   "license": "MIT",
   "repository": {
     "type": "git",
-    "url": "https://git.vzqk50.com/ApisNecros/ts-starfish"
+    "url": "https://git.vzqk50.com/ApisNecros/ts-sun"
   },
   "dependencies": {
     "@types/node": "^20.11.14",

+ 3 - 3
src/codebox.ts

@@ -62,7 +62,7 @@ export class CodeBox {
     }
 
     /**
-     * The No OPeration instruction for Starfish
+     * The No OPeration instruction for Sunfish
      * @readonly
      */
     private NOP = " "; 
@@ -74,9 +74,9 @@ export class CodeBox {
     private MOVEMENT_AND_MIRRORS = [">", "<", "^", "v", "/", "\\", "|", "_", "#", "x", "`", "O"];
 
     /**
-     * Create a Starfish CodeBox
+     * Create a Sunfish CodeBox
      * 
-     * The CodeBox is the engine of the Starfish interpreter.
+     * The CodeBox is the engine of the Sunfish interpreter.
      * 
      * @param rawCodeBox The initial CodeBox provided by the user
      * @param initialStack The initial stack of values provided by the user

+ 6 - 6
src/errors.ts

@@ -1,36 +1,36 @@
 import * as util from "util";
 
-export class StarfishError extends Error {
+export class SunfishError extends Error {
     constructor(message: string = "") {
         super(`Something smells fishy!\n${message}`);
     }
 }
 
-export class UnknownInstructionError extends StarfishError {
+export class UnknownInstructionError extends SunfishError {
     constructor(badInstruction: string) {
         super(`${badInstruction}" is not defined`);
     }
 }
 
-export class EmptyCodeBoxError extends StarfishError {
+export class EmptyCodeBoxError extends SunfishError {
     constructor() {
         super("Cannot have an empty CodeBox (No room for the fish to survive)");
     }
 }
 
-export class FailedToParseCodeBoxError extends StarfishError {
+export class FailedToParseCodeBoxError extends SunfishError {
     constructor(badCodeBoxString: string|string[]|string[][]) {
         super("Failed to parse CodeBox input.\n"+util.inspect(badCodeBoxString));
     }
 }
 
-export class EmptyStackError extends StarfishError {
+export class EmptyStackError extends SunfishError {
     constructor() {
         super("Unable to perform this operation on an empty stack");
     }
 }
 
-export class WrongStackSizeError extends StarfishError {
+export class WrongStackSizeError extends SunfishError {
     constructor(elementsWanted: number, stackSize: number) {
         super(`Failed to perform an operation on ${elementsWanted} on a stack with only ${stackSize} elements`);
     }