# RingCode

RingCode is an esoteric programming language invented by Tom Price-Nicholson in 2014. RingCode is based on the Tengwar alphabet from Lord of the Rings. The Tengwar are described in this article rather than pictured, but a full entry (including pictures) is available on Wikipedia. RingCode behaves as if it has a 2 dimensional array, with a pointer that can move through the array. Each cell of the array can hold either an int or a char but not a string or a float. To begin with, each cell has the entry 0 and the pointer is at the cell (0,0). WARNING: the letters represented by the Tengwar in this programming language are NOT their official translations. For the official translations, please see the Wikipedia page on Tengwar (click here).

## Describing the Tengwar

Each Tengwar letter, called a tengwa, consists of a stem and a bow. The states that each of these can be in will be represented by letters. The stem can either be short (S), in the style of an a, a u or an n; long ascending (A), in the style of a b or a d; or long descending (D), in the style of a p or a q. The bow can either be on the left (L) of the stem, in which case it is open at the top like a u, or on the right (R) of the stem, in which case it is open at the bottom, like an n. The bow can be single, like an n, or doubled (2) like an m. The bow may be open, like in u or n, or closed (C) like in b or q. Following these rules, a double-bowed open tengwar with a long ascending stem and the bow on the right is designated AR2. If the bow is closed, it is AR2C. AR2C looks similar to a b with two circles at the bottom instead of one. The Tengwar can be seen here

## Describing the Tehtar

The Tehtar are a set of diacritical marks, such as those placed above á or ê. There are 8 tehtar used in this code, leading to nine variations of each tengwa (8 with a tehtar plus one without). Two of the tehtar go under the bow of the tengwa: an underline (_) and a double dot (..). The other six tehtar go above the bow of the tengwa: a chevron (^), a tringle (...), a dot (.), an accent (/), a curl to the left (ˀ) and a curl to the right (ˁ).

## Syntax

The tengwar, along with the tehtar to modify them, form the syntax for RingCode. A table of each tengwar and it's translation is given below:

Tengwa Translation Tengwa Translation Tengwa Translation Tengwa Translation
DR a (b) DRC c (d) DL e (f) DLC g (h)
DR2 i (j) DR2C k (l) DL2 m (n) DL2C o (p)
AR q (r) ARC s (t) AL u (v) ALC w (x)
AR2 y (z) AR2C 0 (1) AL2 2 (3) AL2C 4 (5)
SR2 6 (7) SR2C 8 (9) SL2 . (,) SL2C ! (?)
SR + (-) SRC * (/) SL % (^) SLC space (newline)

### Adding tehtar to form instructions

The tehatar modify the tengwar in the following ways:

• No tehtar - tengwa represents it's translation and is not part of the code. Can be used to form comments, or just so that the program actually translates to words instead of random letters that stand for instructions.
• .. - tengwa represents the translation in brackets, e.g DR.. = b. Not part of the code, and used for the same reasons as above.
• _ - move pointer. R tengwar move the pointer one space right, RC tengwar move it one space up, L tengwar move it one space left and LC tengwar move it one space down.
• ^ - open tengwar: ask for an input, empty the current cell, then store the input in the current cell if it is an int or char. Closed tengwar: output the int or char stored in the current cell.
• ... - clear the cell, then input the translation of the tengwar. Can be used in conjunction with ..
• . - increment the value of the current cell.
• / - decrement the value of the current cell.
• ˀ - beginning of a loop. If the current cell is non-zero, continue. Otherwise, jump to the instruction immediately after the tengwa of the same type with a ˁ tehtar.
• ˁ - end of a loop. Jump backwards to the tengwa of the same type with a ˀ tehtar.

## Example programs

If anybody comes up with any example programs, feel free to post them here.