Give README more modern file extension.
Chris Pressey
2 years ago
0 | The Etcha Programming Language | |
1 | ============================== | |
2 | ||
3 | _Try it online_ [@ catseye.tc](https://catseye.tc/installation/Etcha) | |
4 | | _Wiki entry_ [@ esolangs.org](https://esolangs.org/wiki/Etcha) | |
5 | | _See also:_ [Whothm](https://github.com/catseye/Whothm#readme) | |
6 | ∘ [Wunnel](https://github.com/catseye/Wunnel#readme) | |
7 | ∘ [Gemooy](https://github.com/catseye/Gemooy#readme) | |
8 | ||
9 | - - - - | |
10 | ||
11 | Introduction | |
12 | ------------ | |
13 | ||
14 | Etcha is an esoteric programming language based on Jeffry Johnston's | |
15 | [BitChanger](http://www.esolangs.org/wiki/BitChanger). Like BitChanger, | |
16 | Etcha has four instructions, two of which are used to form | |
17 | Brainfuck-like while-loops. Unlike BitChanger, Etcha has a 2-dimensional | |
18 | storage model based on turtle graphics, which permits it to be | |
19 | immediately used for an alternative purpose: graphical composition. | |
20 | Unlike a classical turtle in a language such as LOGO however, the turtle | |
21 | in Etcha is an integral part of the computation, playing a role similar | |
22 | to the tape head of a Turing machine. | |
23 | ||
24 | Instructions | |
25 | ------------ | |
26 | ||
27 | - `+` -- equivalent to FD 1 | |
28 | - `>` -- equivalent to RT 90; toggles PU/PD every 4 executions | |
29 | - `[` -- equivalent to While | |
30 | - `]` -- equivalent to Wend | |
31 | ||
32 | In Etcha, instructions control a turtle. The turtle exists vis-a-vis an | |
33 | unbounded Cartesian grid called the playfield. The turtle has a position | |
34 | in that it occupies exactly one of the points on the playfield (which | |
35 | are referred to as pixels). Each pixel has a state, which is either | |
36 | black or white; all pixels are initially black. | |
37 | ||
38 | The turtle also has an orientation which describes the direction it | |
39 | would move in should it travel forward. Unlike a conventional turtle, | |
40 | because of its Cartesian context, there are only four possible | |
41 | orientations which the Etcha turtle can possess: north, east, south, and | |
42 | west, corresponding to headings of 0, 90, 180, and 270 degrees. When an | |
43 | Etcha program starts, the turtle is initially oriented north. Because | |
44 | position is relative, it doesn't matter where the turtle is initially | |
45 | located, but solely for psychological satisfaction we can say that it is | |
46 | initially situated in the very center of this unbounded Cartesian grid. | |
47 | ||
48 | The turtle is also equipped with a pen, which has a pen mode and a pen | |
49 | position. The pen mode is always XOR, meaning that when moving forward | |
50 | by execution of `+`, the state of the pixel that was previously occupied | |
51 | by the turtle gets inverted (from black to white, or vice versa.) The | |
52 | pen position may be up or down. It is initially down. Every fourth time | |
53 | an `>` instruction is executed, the pen's position is toggled from up to | |
54 | down or vice versa. These executions need not be consecutive; there may | |
55 | be any number of intervening instructions executed. | |
56 | ||
57 | Examples | |
58 | -------- | |
59 | ||
60 | -> Tests for functionality "Interpret Etcha Program" | |
61 | ||
62 | -> Functionality "Interpret Etcha Program" is implemented by shell | |
63 | -> command "java -cp bin tc.catseye.etcha.Main %(test-body-file)" | |
64 | ||
65 | | >+++>+++>+++>+++>[+]>>>>+ | |
66 | = ---- | |
67 | = ##### | |
68 | = # | |
69 | = # | |
70 | = ### | |
71 | = ---- | |
72 | ||
73 | Computational Class | |
74 | ------------------- | |
75 | ||
76 | Etcha is Turing-complete if BitChanger is, because we can easily | |
77 | translate any BitChanger program into an equivalent Etcha program. Let | |
78 | the Etcha program begin with `>>>>`, to initially lift the pen. The | |
79 | BitChanger instruction `<` is translated to the Etcha instructions | |
80 | `>>>+>>>>>`, and the BitChanger instruction `}` is translated to | |
81 | `>>>>>+>>>`. The instructions `[` and `]` remain the same. The relation | |
82 | between the BitChanger tape state and the Etcha playfield is quite | |
83 | literal; the y dimension of the grid is simply ignored. | |
84 | ||
85 | Implementation | |
86 | -------------- | |
87 | ||
88 | In a particular implementation of Etcha on a microcomputer with a finite | |
89 | storage, the playfield cannot be truly unbounded, and there will come a | |
90 | point in a long enough program execution, entirely dependent on the | |
91 | capabilities of the hardware and the implementation, where a pixel | |
92 | change cannot be correctly stored. The behaviour after this point is | |
93 | undefined. *Such (m)icro(c)omputer implementations of Etcha may be | |
94 | marketed under the name "MC Etcha"*. | |
95 | ||
96 | Cat's Eye Technologies provides an implementation of Etcha written in | |
97 | the Java[TM] programming language. This implementation attempts to | |
98 | demonstrate that the Model-View-Controller design pattern can be applied | |
99 | not only to user interfaces, but also to programming language | |
100 | interpreters. The Model is the state of the program (which is also the | |
101 | state of the Turtle graphics engine.) The View is the interpreter's | |
102 | interpretation of that state, and the Controller is the interpreter's | |
103 | behaviour with respect to the View. For example, the Model exposes the | |
104 | pen up/down semantics, but it is the Controller that implements the rule | |
105 | that `>>>>` toggles the pen position. | |
106 | ||
107 | Cat's Eye Technologies' ridiculously over-engineered implementation of | |
108 | Etcha is in the public domain. | |
109 | ||
110 | Happy Etchin'! | |
111 | Chris Pressey | |
112 | October 4th, 2009 | |
113 | Mold City, USA |
0 | The Etcha Programming Language | |
1 | ============================== | |
2 | ||
3 | _Try it online_ [@ catseye.tc](https://catseye.tc/installation/Etcha) | |
4 | | _Wiki entry_ [@ esolangs.org](https://esolangs.org/wiki/Etcha) | |
5 | | _See also:_ [Whothm](https://github.com/catseye/Whothm#readme) | |
6 | ∘ [Wunnel](https://github.com/catseye/Wunnel#readme) | |
7 | ∘ [Gemooy](https://github.com/catseye/Gemooy#readme) | |
8 | ||
9 | - - - - | |
10 | ||
11 | Introduction | |
12 | ------------ | |
13 | ||
14 | Etcha is an esoteric programming language based on Jeffry Johnston's | |
15 | [BitChanger](http://www.esolangs.org/wiki/BitChanger). Like BitChanger, | |
16 | Etcha has four instructions, two of which are used to form | |
17 | Brainfuck-like while-loops. Unlike BitChanger, Etcha has a 2-dimensional | |
18 | storage model based on turtle graphics, which permits it to be | |
19 | immediately used for an alternative purpose: graphical composition. | |
20 | Unlike a classical turtle in a language such as LOGO however, the turtle | |
21 | in Etcha is an integral part of the computation, playing a role similar | |
22 | to the tape head of a Turing machine. | |
23 | ||
24 | Instructions | |
25 | ------------ | |
26 | ||
27 | - `+` -- equivalent to FD 1 | |
28 | - `>` -- equivalent to RT 90; toggles PU/PD every 4 executions | |
29 | - `[` -- equivalent to While | |
30 | - `]` -- equivalent to Wend | |
31 | ||
32 | In Etcha, instructions control a turtle. The turtle exists vis-a-vis an | |
33 | unbounded Cartesian grid called the playfield. The turtle has a position | |
34 | in that it occupies exactly one of the points on the playfield (which | |
35 | are referred to as pixels). Each pixel has a state, which is either | |
36 | black or white; all pixels are initially black. | |
37 | ||
38 | The turtle also has an orientation which describes the direction it | |
39 | would move in should it travel forward. Unlike a conventional turtle, | |
40 | because of its Cartesian context, there are only four possible | |
41 | orientations which the Etcha turtle can possess: north, east, south, and | |
42 | west, corresponding to headings of 0, 90, 180, and 270 degrees. When an | |
43 | Etcha program starts, the turtle is initially oriented north. Because | |
44 | position is relative, it doesn't matter where the turtle is initially | |
45 | located, but solely for psychological satisfaction we can say that it is | |
46 | initially situated in the very center of this unbounded Cartesian grid. | |
47 | ||
48 | The turtle is also equipped with a pen, which has a pen mode and a pen | |
49 | position. The pen mode is always XOR, meaning that when moving forward | |
50 | by execution of `+`, the state of the pixel that was previously occupied | |
51 | by the turtle gets inverted (from black to white, or vice versa.) The | |
52 | pen position may be up or down. It is initially down. Every fourth time | |
53 | an `>` instruction is executed, the pen's position is toggled from up to | |
54 | down or vice versa. These executions need not be consecutive; there may | |
55 | be any number of intervening instructions executed. | |
56 | ||
57 | Examples | |
58 | -------- | |
59 | ||
60 | -> Tests for functionality "Interpret Etcha Program" | |
61 | ||
62 | -> Functionality "Interpret Etcha Program" is implemented by shell | |
63 | -> command "java -cp bin tc.catseye.etcha.Main %(test-body-file)" | |
64 | ||
65 | | >+++>+++>+++>+++>[+]>>>>+ | |
66 | = ---- | |
67 | = ##### | |
68 | = # | |
69 | = # | |
70 | = ### | |
71 | = ---- | |
72 | ||
73 | Computational Class | |
74 | ------------------- | |
75 | ||
76 | Etcha is Turing-complete if BitChanger is, because we can easily | |
77 | translate any BitChanger program into an equivalent Etcha program. Let | |
78 | the Etcha program begin with `>>>>`, to initially lift the pen. The | |
79 | BitChanger instruction `<` is translated to the Etcha instructions | |
80 | `>>>+>>>>>`, and the BitChanger instruction `}` is translated to | |
81 | `>>>>>+>>>`. The instructions `[` and `]` remain the same. The relation | |
82 | between the BitChanger tape state and the Etcha playfield is quite | |
83 | literal; the y dimension of the grid is simply ignored. | |
84 | ||
85 | Implementation | |
86 | -------------- | |
87 | ||
88 | In a particular implementation of Etcha on a microcomputer with a finite | |
89 | storage, the playfield cannot be truly unbounded, and there will come a | |
90 | point in a long enough program execution, entirely dependent on the | |
91 | capabilities of the hardware and the implementation, where a pixel | |
92 | change cannot be correctly stored. The behaviour after this point is | |
93 | undefined. *Such (m)icro(c)omputer implementations of Etcha may be | |
94 | marketed under the name "MC Etcha"*. | |
95 | ||
96 | Cat's Eye Technologies provides an implementation of Etcha written in | |
97 | the Java[TM] programming language. This implementation attempts to | |
98 | demonstrate that the Model-View-Controller design pattern can be applied | |
99 | not only to user interfaces, but also to programming language | |
100 | interpreters. The Model is the state of the program (which is also the | |
101 | state of the Turtle graphics engine.) The View is the interpreter's | |
102 | interpretation of that state, and the Controller is the interpreter's | |
103 | behaviour with respect to the View. For example, the Model exposes the | |
104 | pen up/down semantics, but it is the Controller that implements the rule | |
105 | that `>>>>` toggles the pen position. | |
106 | ||
107 | Cat's Eye Technologies' ridiculously over-engineered implementation of | |
108 | Etcha is in the public domain. | |
109 | ||
110 | Happy Etchin'! | |
111 | Chris Pressey | |
112 | October 4th, 2009 | |
113 | Mold City, USA |