Skip to content

puzzlet/seshat

Repository files navigation

Seshat is a programming language in Egyptian hieroglyphs. Its goal is to make programming easy for anyone who can read and write Egyptian hieroglyphs.

"Seshat" (𓋇 Zẖꜣ.t) is the name of an Egyptian goddess. The goddess of writing, architecture, and mathematics, she would definitely be the goddess of programming.

# hello.seshat
𓁹𓎡 𓏞𓏜𓎡 𓅓 𓆓𓌃𓇋𓐩𓋇𓅨𓂋𓏏𓎟𓏞𓎟𓐪𓏧𓂢
# ir=k zẖꜣ=k ḏd-mdw j.nḏ Zẖꜣ.t Nb.t Wr.t Zẖꜣ Nb.t Jqd.w grḥ
# "Do write: "Hail Seshat, the Great, Mistress of the Script, Mistress of the Builders."
$ node build/lib/seshat.js hello.seshat
𓇋𓐩𓋇𓅨𓂋𓏏𓎟𓏞𓎟𓐪𓏧

But seriously, there are upsides about ancient Egyptian programming

Algorithms before antiquity

Among the oldest mathematical texts in human history are Rhind Mathematical Papyrus and Moscow Mathematical Papyrus. They mostly consist of problems and their solutions, and the solutions are written as line-by-line instructions. Like a description of an algorithm, they're very programmatic:

Make 10 heqats of the fat into ro; it shall become 3200.
Make a year into days; it shall become 365.
Divide 3200 by 365; it shall become 8 + 2/3 + 1/10 + 1/2190.
Make this in [haqet and ro notation]; 1/64 [haqet and] 2/3 + 1/10 + 1/2190 ro.

-- from Rhind Mathematical Papyrus Problem 66

x = heqat_to_ro(10)
assert x == 3200
assert days_in_a_year == 365
x = x / days_in_a_year
assert x == 8 + 2/3 + 1/10 + 1/2190
result = ro_to_haqet_and_ro(x)
assert result.haqet == 1/64
assert result.ro == 2/3 + 1/10 + 1/2190

Binary calculations

For multiplications and divisions, Egyptians used a method called "doubling." For example, to calculate 2000 * 5, they simply doubled 2000 until the multiplier reachs high enough for 5, and added things up:

\ 1     2000
  2     4000
\ 4     8000
Total  10000

-- from Rhind Mathematical Papyrus Problem 52

Over 3000 years later, it is similar to how computers multiply numbers every day.

Type systems everywhere

Egyptians used what we call "determinatives" at the ends of words to specify the categories of the meanings of the words. For example, the words 𓊢𓂝𓂻 ꜥḥꜥ "to stand" and 𓊢𓂝𓇤 ꜥḥꜥ "heap, quantity (in mathematics)" share the same spelling 𓊢𓂝 ꜥḥꜥ, but the determinatives 𓂻 and 𓇤 tell the meaning and make the words different. Like when we declare variables in typed programming languages.

In Seshat, you might use 𓇤 at the end of a variable to indicate it's about the quantity, namely a number variable. Or a papyrus scroll 𓏛 for the string variables.

Documentation

TODO

References & Further Readings

The first books

Reimer (2014) is a good introductory book about ancient Egyptian mathematics.

If you are interested in Egyptian hieroglyphs for the first time, McDermott (2001) would be a good starter. Collier & Manley (1998) gives more about grammar and vocabulary.

  • Collier, M. & Manley, B. (1998). How to read Egyptian hieroglyphs: a step-by-step guide to teach yourself. Univ of California Press.
    • at archive.org
    • 《(대영박물관이 만든) 이집트 상형문자 읽는 법》. 하연희 옮김. 루비박스, 2005.
  • McDermott, B. (2001). Decoding Egyptian hieroglyphs: How to read the secret language of the pharaohs. Chronicle Books.
    • at archive.org
    • 《파라오의 비밀문자: 이집트 상형문자 읽는 법》. 권영진 옮김. 예경, 2005.
  • Reimer, D. (2014). Count like an Egyptian: a hands-on introduction to ancient mathematics. Princeton University Press.

Language & dictionaries

  • Allen, J. P. (2000). Middle Egyptian: An introduction to the language and culture of hieroglyphs. Cambridge University Press.
  • Budge, E. A. W. (1911). A Hieroglyphic Vocabulary to the Theban Recension of the Book of the Dead: with an index to all the English equivalents of the Egyptian words (Vol. 31). Kegan Paul, Trench, Trübner & Co. Ltd.
  • Budge, E. A. W. (1920). An Egyptian Hieroglyphic Dictionary: with an index of english words, king list, and geographical list with indexes, list of hieroglyphic characters, coptic and semitic alphabets (Vols. 1-2). John Murray.
  • Dickson, P. (2006). Dictionary of middle Egyptian in Gardiner classification order.
  • Faulkner, R. O. (1964). A concise dictionary of Middle Egyptian.
  • Gardiner, A. H. (1927). Egyptian grammar: being an introduction to the study of hieroglyphs. 3rd ed. Oxford University Press.
  • Loprieno, A. (1995). Ancient Egyptian: a linguistic introduction. Cambridge University Press.

Online dictionaries

The texts & researches

  • Chace, A. B., Archibald, R. C., Bull, L., Glanville, S. R. K., & Manning, H. P. (1929). The Rhind Mathematical Papyrus. Volume II: Photographs, Transcription Transliteration, Literal Translation. Mathematical Association of America.
  • Clagett, M. (1999). Ancient Egyptian Science: A Source Book (vol. 3). American Philosophical Society.
  • Imhausen, A. (2002). Ägyptische Algorithmen: eine Untersuchung zu den mittelägyptischen mathematischen Aufgabentexten (Vol. 65). Harrassowitz Verlag.
  • Ritter, J. (2002). Closing the Eye of Horus: The Rise and Fall of 'Horus-eye Fractions'. In J. M. Steele & A. Imhausen (Eds.), Under One Sky: Astronomy and Mathematics in the Ancient Near East (pp. 297-323). Ugarit-Verlag.
  • Sethe, K. (1908). Die altägyptischen Pyramidentexte nach den Papierabdrucken und Photographien des Berliner Museums, (Vols. 1-2). J. C. Hinrichs'sche Buchhandlung.
  • Struve, W. W. (1930). Mathematischer Papyrus des staatlichen Museums der schönen Künste in Moskau: herausgegeben und kommentiert von WW Struve, unter Benutzung einer hieroglyphischen Transkription von BA Turajeff (Quellen und Studien zur Geschichte der Mathematik, Abt. A, Quellen, Band 1). Verlag von Julius Springer.