Hieroglyphics

From Esolang
Jump to navigation Jump to search
Not to be confused with Hieroglyphic.

Hieroglyphics is an esolang based on Ancient Egyptian hieroglyphics. It was formed basically by taking everything the Egyptians did and trying to turn it into code. As such, it may be a little confusing.

Layout

Hieroglyphics is somewhat unusual in that it is read from right to left, in the same way the Egyptians did (mostly). In addition, although some of my examples further down this page were given as if they were on one line, they should actually be written as quadrats, like this:

{TODO: Give example}

A code may use objects of the following type: literal values, expressions, functions, variables, tuples and lists. If it is ever unclear which is which, determinatives may be used, but the compiler will always attempt to infer from context. A quadrat may contain more than one type, or several objects of the same type, but no object may be split across several quadrats.

Literals

Numbers

The natural numbers in Hieroglyphics are formed by adding powers of 10. The character 0 represents 1, 1 represents 10, 2 represents 100, and so on up to 9. Thus 276 would be written as 000000111111122. The ! character on its own represents 0, and with other numerals represents a minus sign, for example 012! is -111. The letter r represents 1 divided by something. 1/32 would be 00111r. (The Egyptians used a mouth, which they also used as an "r" sound.)

Addition is done using the sign <, subtraction using > (they look like the Egyptian symbols turned round). You can represent unusual fractions this way: 2/7 would be 0000000011r<0000r.

The determinative is #.

Strings

Strings are given the determinative "

Variables

Variables always have 2 determinatives: the determinative of a literal in the same class, and the ? symbol. The name may be made from any non-whitespace UNICODE symbols.

To create or change a variable, type the symbol *, the value required, and the * again, then the variable name: *"Hello*"?foo. Variables and functions are local unless they are in a cartouche like these:

|(?foo)

|/###Important\
|\ListOfFloats/

| /Very\
|/ Long \
|\ Func /
| \Name/

in which case they are global, and must have a cartouche every time they are referenced.