tapmach 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,51 +1,89 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
1
3
|
# tapmach
|
|
2
4
|
|
|
3
|
-
**tapmach
|
|
5
|
+
**tapmach**, a list-based programming language designed for visual execution and extreme simplicity. It focuses on manipulating a dynamic array of cells through a clean interface. It is also quite performant.
|
|
4
6
|
|
|
5
7
|
>[!note]
|
|
6
|
-
> All the claims of performance are restrained by the execution speed of javascript. So don't
|
|
8
|
+
> All the claims of performance are restrained by the execution speed of javascript. So don't assume this can beat C or other high performance programming languages.
|
|
7
9
|
|
|
8
|
-
---
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
## 🚀 Getting Started
|
|
11
12
|
|
|
12
13
|
To run the Tapmach environment, ensure you have **Bun** installed, then execute:
|
|
13
14
|
|
|
14
15
|
```bash
|
|
15
|
-
bun
|
|
16
|
+
bun add -g tapmach
|
|
16
17
|
```
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
This will install tapmach on your system. To run the server just type `tapmach` on the command line.
|
|
20
|
+
|
|
21
|
+
The server will start at `http://localhost:3000`. Use the built-in editor to write your code and hit the **Run** button to see the your program come to life. To stop the server, press `q` in your terminal.
|
|
22
|
+
|
|
23
|
+
>[!note]
|
|
24
|
+
> I am quite sorry but `Ctrl+C` doesn't work if you want to exit the program.
|
|
19
25
|
|
|
20
|
-
---
|
|
21
26
|
|
|
22
|
-
|
|
27
|
+
## 📜 Language Reference
|
|
23
28
|
|
|
24
29
|
Tapmach operates on a **Tape** (a sequence of cells). You interact with the "current" cell by creating, modifying, or destroying it.
|
|
25
30
|
|
|
31
|
+
The tape can be understood as the memory of the program in the form of a list. Also it is the only type of data-structure you can use in this programming language.
|
|
32
|
+
|
|
33
|
+
There are currently 3 instruction sets to suit different tastes.
|
|
34
|
+
You can switch to a different instruction set using the `Modes` dropdown menu.
|
|
35
|
+
|
|
36
|
+
Now lets understand the syntax of all the 3 instruction sets.
|
|
37
|
+
|
|
38
|
+
### `Default` Instruction Set
|
|
39
|
+
|
|
40
|
+
It has the following instruction set -
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
| Instruction | Description |
|
|
44
|
+
| :--- | :--- |
|
|
45
|
+
| `create_cell` | Appends a new cell to the end of the tape/memory with an initial value of `0`. |
|
|
46
|
+
| `add <number>` | Adds the specified integer to the value of the currently active cell. |
|
|
47
|
+
| `destroy_cell`| Removes the current cell from the tape/memory. |
|
|
48
|
+
| `move <number>` | Moves through the tape/memory with the specified integer. |
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
Now one important thing to note here is that the `add` and `move` instructions can receive negative integers.
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### `Shortcodes` Instruction Set
|
|
55
|
+
|
|
56
|
+
The instruction set of this is similar to the `Default` Instruction Set and is just composed of shortcodes.
|
|
57
|
+
|
|
58
|
+
|
|
26
59
|
| Instruction | Description |
|
|
27
60
|
| :--- | :--- |
|
|
28
|
-
| `
|
|
61
|
+
| `cc` | Appends a new cell to the end of the tape/memory with an initial value of `0`. |
|
|
29
62
|
| `add <number>` | Adds the specified integer to the value of the currently active cell. |
|
|
30
|
-
| `
|
|
63
|
+
| `dc`| Removes the current cell from the tape/memory. |
|
|
64
|
+
| `mov <number>` | Moves through the tape/memory with the specified integer. |
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
### `Numberless Shortcodes` Instruction Set
|
|
31
68
|
|
|
32
69
|
>[!note]
|
|
33
|
-
>
|
|
70
|
+
> Actual meaning of numberless is countless, but sometimes it can refer to absence of numbers.
|
|
34
71
|
|
|
35
|
-
|
|
72
|
+
This instruction set has a little more keywords. Since there are no numbers.
|
|
36
73
|
|
|
37
|
-
### 🛠 Technical Architecture
|
|
38
74
|
|
|
39
|
-
|
|
75
|
+
| Instruction | Description |
|
|
76
|
+
| :--- | :--- |
|
|
77
|
+
| `cc` | Appends a new cell to the end of the tape/memory with an initial value of `0`. |
|
|
78
|
+
| `add` | Adds 1 to the value of the currently active cell. |
|
|
79
|
+
| `sub` | Subtracts 1 to the value of the currently active cell. |
|
|
80
|
+
| `dc` | Removes the current cell from the tape/memory. |
|
|
81
|
+
| `mov` | Moves forward in the tape/memory with a value of 1. |
|
|
82
|
+
| `vom` | Moves backward in the tape/memory with a value of a value of 1. |
|
|
40
83
|
|
|
41
|
-
* **Runtime:** Powered by **Bun** for fast I/O and dev-server capabilities.
|
|
42
|
-
* **Frontend:** Pure HTML/CSS/JS.
|
|
43
|
-
* **Styling:** Features a minimalist UI.
|
|
44
|
-
* **State:** Code is automatically persisted to `localStorage` using a debounced saving mechanism, ensuring you never lose your work.
|
|
45
84
|
|
|
46
|
-
|
|
85
|
+
## 🎨 Design Goals
|
|
47
86
|
|
|
48
|
-
|
|
87
|
+
* **Minimalist UI:** No clutter, just the code and output.
|
|
88
|
+
* **Performance:** Lightweight execution with minimal dependencies.
|
|
49
89
|
|
|
50
|
-
* **Minimalist UI:** No clutter, just the tape and the code.
|
|
51
|
-
* **Performance:** Lightweight execution with minimal dependencies (`ansis` for terminal styling and `Bun.serve` for the backend).
|